$IFDEF and $IFNDEF Compiler Directives

Top  Previous  Next

 

The $IFDEF directive provides conditional compilation. The format of this directive is

 

$IFDEF name

...statements...

$ELSE

...statements...

$ENDIF

 

The $ELSE and associated statements are optional. Statements conditioned by the $IFDEF directive are ignored if name has not been defined by a previous $DEFINE directive. Statements under the $ELSE directive are ignored if name has been defined by a previous $DEFINE directive.

 

The $IFNDEF directive provides the inverse action of $IFDEF, compiling the following statements if name has not been defined.

 

$IFDEF and $IFNDEF statements may be nested to any depth though nesting more than two deep can make program maintenance very difficult.