next up previous contents
Next: Nested and Named IF Up: Control Flow Previous: IF Statement

IF Construct

The block-IF is a more flexible version of the single line IF,

 
IF( tex2html_wrap_inline43037  logical-expression  tex2html_wrap_inline43039 )THEN

tex2html_wrap_inline43037  then-block tex2html_wrap_inline43039

[ ELSEIF( tex2html_wrap_inline43037  logical-expression tex2html_wrap_inline43039 )THEN

tex2html_wrap_inline43037  elseif-block tex2html_wrap_inline43039

... ]

[ ELSE

tex2html_wrap_inline43037  else-block tex2html_wrap_inline43039 ]

END IF

The first branch to have a true tex2html_wrap_inline43037  logical-expression tex2html_wrap_inline43039 is the one that is executed. If none are found then the tex2html_wrap_inline43037  else-block tex2html_wrap_inline43039 , 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 gif


next up previous contents
Next: Nested and Named IF Up: Control Flow Previous: IF Statement

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.