Intel® Fortran Compiler 17.0 Developer Guide and Reference
Statement: Conditionally executes one statement based on the value of a logical expression. (This statement was called a logical IF statement in FORTRAN 77.)
IF (expr) stmt
expr |
Is a scalar logical expression enclosed in parentheses. |
stmt |
Is any complete, unlabeled, executable Fortran statement, except for the following:
|
When an IF statement is executed, the logical expression is evaluated first. If the value is true, the statement is executed. If the value is false, the statement is not executed and control transfers to the next statement in the program.
The following examples show valid 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
The following shows another example:
USE IFPORT
INTEGER(4) istat, errget
character(inchar)
real x
istat = getc(inchar)
IF (istat) errget = -1
...
! IF (x .GT. 2.3) call new_subr(x)
...