next up previous contents index
Next: Unconditional GO TO Statement Up: Control Statements Previous: Guidelines

Logical-IF Statement


The logical-IF statement is best regarded as a special case of the IF-block when it only contains one statement. Thus:

       IF(E .NE. 0.0) THEN 
           RECIPE = 1.0 / E 
       END IF
can be replaced by a single logical-IF statement:
IF(E .NE. 0.0) RECIPE = 1.0 / E

The general form of the logical-IF statement is:
IF( logical-expression ) statement
The statement is executed only if the logical expression has a true value. Any executable statement can follow except DO, IF, ELSE IF, ELSE, END IF, or END.

Helen Rowlands