5.7.2 Logical IF Statement

The logical IF statement conditionally executes a single Fortran statement based on the current value of a logical expression within the logical IF statement. It takes the following form:


IF (e) st

e
Is a logical expression.
st
Is any complete, executable Fortran statement-except any of the block IF statements, DO, END DO, another logical IF statement, a SELECT CASE, CASE, or CASE DEFAULT statement.

The logical IF statement first evaluates the logical expression e and then acts as follows:

Examples

The following examples show valid logical IF statements:


IF (J.GT.4 .OR. J.LT.1) GO TO 250



IF (REF(J,K) .NE. HOLD) REF(J,K) = REF(J,K) * (-1.5D0)



IF (ENDRUN) CALL EXIT


Previous Page Next Page Table of Contents