Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...


Note
titleContent Freeze

As of July 25th, 2023, there is a content freeze on this page.

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
languagejavascript
#if defined(condition-name)

or

Code Block
languagejavascript
#if not defined(condition-name)


Example:

Code Block
languagejavascript
#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