Target Language Compiler    

Conditional Inclusion

The conditional inclusion directives are

and

%if

The constant-expression must evaluate to an integral expression. It controls the inclusion of all the following lines until it encounters a %else, %elseif, or %endif directive. If the constant-expression evaluates to 0, the lines following the directive are not included. If the constant-expression evaluates to any other integral value, the lines following the %if directive are included up until the %endif, %elseif, or %else directives.

When the Compiler encounters an %elseif directive, and no prior %if or %elseif directive has evaluated to nonzero, the Compiler evaluates the expression. If the value is 0, the lines following the %elseif directive are not included. If the value is nonzero, the lines following the %elseif directive are included up until the subsequent %else, %elseif, or %endif directive.

The %else directive begins the inclusion of source text if all of the previous %elseif statements or the original %if statement evaluates to 0; otherwise, it prevents the inclusion of subsequent lines up to and including the following %endif.

The constant-expression can contain any expression specified in Target Language Expressions.

%switch

The %switch statement evaluates the constant expression and compares it to all expressions appearing on %case selectors. If a match is found, the body of the %case is included; otherwise the %default is included.

%case ... %default bodies flow together, as in C, and %break must be used to exit the switch statement. %break will exit the nearest enclosing %switch, %foreach, or %for loop in which it appears. For example,

In general, this is a more readable form for the %if/%elseif/%else construction.


  Formatting Multiple Inclusion