The $IFDEF Compiler Directive

$IFDEF statement uses the $IF...$ELSE...$ENDIF variation of conditional syntax. $IFDEF tests for the definition of a compile-time symbol. If it is defined and the $ELSE clause is omitted, the statements between $IFDEF and $ENDIF are compiled, otherwise they are ignored. If the $ELSE clause is included, only the statements between $IFDEF and $ELSE are compiled.

If the compile-time symbol is not defined and the $ELSE clause is included, only the statements between $ELSE and $ENDIF are compiled.

The $ELSE compiler directive introduces the alternative clause of an $IFDEF compiler directive. The $ENDIF compiler directive marks the end of a conditional compilation block.

In the following example, identifier is not defined so the statements following the $ELSE compiler directive are compiled. All the statements up to the $ENDIF compiler directive are compiled.

$DEFINE identifier   .
   .
   .
$UNDEFINE identifier$IFDEF identifier   [ statements ]
$ELSE
   [ statements ]
$ENDIF