Executes a block of statements if the logical expression is true.
The block of statements starts immediately following the IF
statement. The block of statements can be followed by optional
ELSE IF statements (any number) and one optional ELSE statement.
The entire block IF construct must be terminated by an END IF
statement. Format:
[name:] IF (e) THEN
block
[ELSE IF (e1) THEN [name]
block]...
[ELSE [name]
block]
END IF [name]
name Is the name of the IF construct.
e,e1 Are logical expressions.
block Is a series of zero or more Fortran statements
(called a statement block).
If a construct name is specified in a block IF statement, the same
name must appear in the terminal END IF statement. If no construct
name is specified in the block IF statement, no name can appear in
the terminal END IF statement. The construct name must be a unique
identifier in the program unit.
NOTE
No additional statement can be placed after the IF
THEN statement in a block IF construct. For
example, the following statement is invalid in the
block IF construct:
IF (e) THEN I = J
This statement is translated as the following
logical IF statement:
IF (e) THENI = J