f78 The #elif Directive Contents|Index|Previous|Next
 

The #elif directive 

One common case of nested conditionals is used to check for more than two possible alternatives. For example, you might have the following statement.

Another conditional directive, #elif, allows this to be abbreviated as in the following example. #elif stands for else if. Like #else, it goes in the middle of “#if”and “#endif” pairs, subdividing the pair; #elif does not require a matching #endif. Like #if, the #elif directive includes an expression to be tested.

The text following the #elif is processed only if the original #if condition failed and the #elif condition succeeds. More than one #elif can go in the same “#if”- “#endif” group. Then the text after each #e 548 lif is processed only if the #elif condition succeeds after the original #if and any previous #elif directives within it have failed. #else is equivalent to #elif1, and #else is allowed after any number of #elif directives, but #elif may not follow #else. 0