From the course: Introduction to Fortran
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Conditional constructs - FORTRAN Tutorial
From the course: Introduction to Fortran
Conditional constructs
- [Instructor] Conditional constructs are how your programs can make decisions. We'll discuss two conditional constructs, if and select case. And I'll briefly mention two others available in the language, select type and select rank. The first conditional construct is the if construct. It has two forms with syntax as shown here. A logical_expression is one that evaluates to true or false. The way this works is that for the first form, only those statements following the first expression that evaluates to true are executed or if the else statement is present and no expression evaluates to true, then those statements are executed. In the single statement form, the statement is only executed if the expression evaluates to true. The other conditional construct we'll discuss is the select case construct with the syntax as shown here. The way this construct works is similar to the if construct and in fact could be…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Chapter intro: The basics47s
-
(Locked)
Variables3m 32s
-
(Locked)
Detailed variable behavior demonstration5m 38s
-
(Locked)
Named constants1m 55s
-
(Locked)
Expressions, order of operations, and type conversions2m 57s
-
(Locked)
Expression demonstration5m 33s
-
(Locked)
Conditional constructs5m 36s
-
(Locked)
Looping constructs4m 37s
-
(Locked)
Arrays3m 49s
-
-
-
-