Syntax

IF expression
      statements
{ ELIF expression
      statements }
[ ELSE
      statements ]
ENDIF     

IFDEF symbol
    ....

IFNDEF symbol
    ....

The controlling expression must be an absolute assembly-time constant. When the expression is non-zero the true conditional arm is assembled; when the expression is zero the false conditional body, if any, is assembled.

The IFDEF and IFNDEF directives are specialised forms of the IF directive. The IFDEF directive tests the existence of the supplied symbol and the IFNDEF directive tests the non-existence of the supplied symbol.

Example
IF type == 1
   CALL type1
ELSE
   IF type == 2
      CALL type2
   ELSE
      CALL type3
   ENDIF
ENDIF

The nested conditional can be replaced using the ELIF directive which acts like ELSE IF:

IF type == 1
   CALL type1
ELIF type == 2
   CALL type2
ELSE
   CALL type3
ENDIF
Example

Usual practice is to use a symbol, _DEBUG, as a flag to either include or exclude debugging code. Now you can use IFDEF   to conditionally assemble some parts of your application depending upon whether the _DEBUG symbol is defined or not.

IFDEF _DEBUG
   CALL DumpAppState
ENDIF