Preprocessor - #elif


The #elif directive means else if. It may be used to establish an if-else-if chain. Like #if, #elif is followed by a symbol expression. The general form of #elif is as follows.

#if symbol-expression
  statement sequence
#elif symbol-expression
  statement sequence
#elif symbol-expression
  statement sequence
 ...
#elif symbol-expression
  statement sequence
#endif

In the above syntax diagram, the final #elif can be converted to an #else.