ELSE IF statement

Standard: (F77) F90 F95 F2003 F2008 F2018 Example program


<Syntax>

ELSE IF ( expression ) THEN [ if-construct-name ]

The blank between ELSE and IF is optional. The expression shall be scalar of type Logical. The if-construct-name may appear only if the corresponding IF-THEN statement is named.

<Semantics>

The ELSE IF statement marks the beginning of an ELSEIF block in an IF construct. It is executed if and only if the expression in the IF statement is false, the expressions for all preceding ELSEIF blocks of the construct are false, and the expression for this ELSEIF block is true.

<Related>

ELSE statement, END IF statement, IF construct, IF statement, IF THEN statement