The block-IF is a more flexible version of the single line IF,
IF(logical-expression
)THEN
then-block
![]()
[ ELSEIF(
logical-expression
)THEN
elseif-block
![]()
... ]
[ ELSE
else-block
]
END IF
The first branch to have a true logical-expression
is
the one that is executed.
If none are found then the
else-block
, if present, is executed.
For example,
IF (x .GT. 3) THEN CALL SUB1 ELSEIF (x .EQ. 3) THEN A = B*C-D ELSE IF (y .NE. 0) A=B ENDIF
IF blocks may also be nested.
For more information, click here