IF

Conditional assembler directive.

IF expression..[ELSE]..ENDIF

Remarks

Part of a program that is to be conditionally assembled must be bounded by an IF- ENDIF directive pair. If the optional ELSE directive is not present, then the source statements following the IF directive and up to the next ENDIF directive are included as part of the source file being assembled only if the expression has a nonzero result. If the expression has a value of zero, the source file is assembled as if those statements between the IF and the ENDIF directives were never encountered. If the ELSE directive is present and expression has a nonzero result, then the statements between the IF and ELSE directives are assembled, and the statements between the ELSE and ENDIF directives are skipped. Alternatively, if expression has a value of zero, then the statements between the IF and ELSE directives are skipped, and the statements between the ELSE and ENDIF directives are assembled.

The expression must have an absolute integer result and is considered true if it has a nonzero result. The expression is false only if it has a result of 0. Because of the nature of the directive, expression must be known on pass one (no forward references allowed). IF directives can be nested to any level. The ELSE directive is always referred to the nearest previous IF directive as is the ENDIF directive.

A label is not allowed with this directive.

Example

IF @LST()>0

DUP @LST() ; Unwind LIST directive stack

NOLIST

ENDM

ENDIF

See also

ENDIF