The IF construct has the following syntax,
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 ELSEIF (x .EQ. 2) THEN A = B*B ELSE IF (y .NE. 0) A=B ENDIF
IF blocks may also be nested.
For more information, click here