IF blocks have the same form as in Fortran:
IF (logical expression) THEN
statements
ENDIF
If only one statement is needed, the one-line form
IF (logical expression) statement
can be used, except if statement is a procedure name.
ELSE and ELSE IF can be used exactly as in Fortran. IF statements may be arbitrarily nested. Jumps into IF or ELSE IF blocks are allowed. In this case no testing is performed; when an ELSE is reached, control continues after ENDIF.
The logical expression may involve logical comparisons of algebraic expressions or of strings. Examples:
IF(STATUS.LT.0) THEN TEXT,An error occurred, calculation stopped STOP ENDIF
IF($method.eq.'HF') then ... ENDIFIn the previous example the dollar and the quotes are optional:
IF(METHOD.EQ.HF) then ... ENDIF