Begins an IF construct.
Syntax
[construct-name :] IF (logical-expression) THEN |
- construct-name
is the name given to the IF construct. If construct-name is specified, the same name must also appear in the END IF statement.
- logical-expression
is a scalar logical expression.
Description
The IF statement executes the immediately following statement
block if logical-expression evaluates to true.
The IF construct, which the IF statement begins, may include ELSE IF statements and an ELSE statement to provide alternate statement blocks
for execution.
The block following the IF statement may be empty.
As an extension,
HP Fortran allows the transfer of control into an IF construct from outside the construct.
Examples
IF (x <= 0.0 .AND. y > 1.0) THEN CALL fix_coord(x, y) END IF |
Related statements
ELSE, ELSE IF, IF (arithmetic), IF (logical), and END (construct)
Related concepts
For information about the IF construct, see “IF construct”.