The IF statement controls whether or not a statement is executed based on the value of a logical expression.
SyntaxIF (expr) action-statementWhere:
expr is a scalar LOGICAL expression.
action-statement is an executable statement other than another IFor 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.
Examplereal :: a=-1 if (a < 0) write(*,*) " a must be less than zero,& & because this statement was executed"