The IF directive provides a conditional-assembly feature.
The structure of conditional assembly is much like that used by high-level language conditional constructs and by the C pre-processor. The directives IF, IFDEF, IFNDEF, ELIF, and ENDIF are available.
These directives may be prefixed with a # and can start in the first column, thus enabling them to look like C pre-processor directives.
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 specialized forms of the IF directive. IFDEF tests for the existence of the supplied symbol, IFNDEF tests for the non-existence of the supplied symbol.
IF type == 1 CALL type1 ELSE IF type == 2 CALL type2 ELSE CALL type3 ENDIF ENDIF
The nested conditional can be replaced by using the ELIF directive, which acts like ELSE IF:
IF type == 1 CALL type1 ELIF type == 2 CALL type2 ELSE CALL type3 ENDIF
The 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 on whether the _DEBUG symbol is defined.
IFDEF _DEBUG CALL DumpAppState ENDIF