Versions Compared

Key

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

The #elseif compiler directive is used to test a conditional expression within an #if or #elseif group.

If the previous #if or #elseif was not satisfied, and the conditional expression is true, then source lines following the #elseif directive are selected to be read. Otherwise, lines are excluded until the next #elseif, #else or #endif in the same #if group is encountered.

 

The syntax is as follows:

 

Code Block
#elseif defined(condition)

 

or

 

Code Block
#elseif not defined(condition)

 


 

Example:

 

 

 

Code Block
languagejavascript
#if defined(abc)
  // JavaScript logic
#elseif defined(xyz)
  // JavaScript logic
#else
  // JavaScript logic
#endif

 

 

 

RPG Equivalent

 

/ELSEIF