IF (condition A) THEN
statements A
ELSE IF (condition B) then
statements B
ELSE
statements C
END IF
Notes:
.true. or .false.), a logical variable (just the variable name), or a logical expression (logical values combined using logical operators).
DO var = start, stop, increment
statements
END DO
Notes:
int((stop-start)/inc)
times. If this number is not positive, the loop is skipped.
var = var + increment and
repeats if the resulting value of var is within the [start,
stop] range.
EXIT statement.
DO WHILE (condition)
statements
END DO
Notes:
.true. Thus, our do
while(.true.)
loops will always be infinite, and we will use EXIT
(in an IF statement in the loop body) to abort.
read*, List ! reads all the declared elements of array List print*, (i, List(i), i=1,20,2) ! prints selected elements using an implied DO LOOP