ELSE IF
◄Up► ◄Contents► ◄Index► ◄Back►
─────ELSE IF────────────────────────────────────────────────────────────────
Action
Causes execution of a block of statements if <expression> is true.
Syntax
ELSE IF (expression) THEN
Parameter Description
expression A logical expression
Remarks
The next statement to execute depends on the value of expression.
If expression is: Then the next statement executed is:
True The first executable statement following THEN
False The next ELSE IF, ELSE, or END IF statement at
the same IF level
After the last statement in the ELSE IF block executes, program
flow transfers to the END IF statement associated with the ELSE
IF statement.
Control may not be transferred into an ELSE IF block from outside
that block.
See Also: ◄ELSE►
◄►nt'>END IF
◄IF THEN ELSE►
Example
CHARACTER char
READ (*, '(A)') char
IF (char .EQ. 'L') THEN
CALL Lsub
ELSE IF (char .EQ. 'X') THEN
CALL Xsub
ELSE
CALL Other
END IF
-♦-