Lahey/Fujitsu Fortran

IF Statement


The IF statement controls whether or not a statement is executed based on the value of a logical expression.


IF (expr) action-statement

expr is a scalar LOGICAL expression.

action-statement is an executable statement other than another IF

or the END statement of a program, function, or subroutine.


Execution of an IF statement causes evaluation of the logical expression.

If the expression is true, the action-statement is executed.

If the value is false, the action-statement is not executed.


real :: a=-1 if (a < 0) write(*,*) " a must be less than zero,& & because this statement was executed"