Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
$IF
◄Up► ◄Contents► ◄Index► ◄Back►
─────$IF────────────────────────────────────────────────────────────────────
Action
Conditionally compiles a statement block if an expression is .TRUE.
If the <expression> is .FALSE., control is transferred to the next
$ELSE, $ELSEIF, or $ENDIF metacommand at the same $IF level.
Syntax $IF expression
Parameter Description
expression A logical expression
Remarks
The logical <expression> in a $IF metacommand can take two forms.
■ The conditional compilation operator DEFINED, followed by a
symbol name in parentheses.
■ A logical comparison, where the value of the symbol is
compared with an integer constant or the value of another
symbol.
Example
$DEFINE flag
$DEFINE testval = 3
$IF DEFINED (flag)
WRITE (*, '('' This is compiled if flag DEFINED'')')
$ENDIF
.
.
.
$IF (testval .LT. 1) .AND. .NOT. DEFINED (flag)
WRITE (*, '('' Testval .LT. 1 .AND. flag .NOT. DEFINED'')')
$ELSE
WRITE (*, '('' Testval .GE. 1 .OR. flag DEFINED'')')
$ENDIF
-♦-