...
title | Content Freeze |
---|
...
The #if compiler directive is used to test an expression for conditional compilation.
If the conditional expression is true, source lines following the #if directive are selected to be read by the compiler. Otherwise, lines are excluded until the next #elseif, #else, or #endif in the same #if group are reached.
The syntax is as follows:
Code Block | ||
---|---|---|
| ||
#if defined(condition-name) |
or
Code Block | ||
---|---|---|
| ||
#if not defined(condition-name) |
Example:
Code Block | ||
---|---|---|
| ||
#if not defined(ranonce) // this code will only run one time // even if this source file is included more than once with #include number = number + 1; #endif #define ranonce |
RPG Equivalent:
/IF