Information Technology Reference
In-Depth Information
The
#if...#elif
, and
#if...#elif...#else
constructs are illustrated in Figure 22-2.
In the
#if...#elif
construct, if
Cond1
evaluates to
true
,
CodeSection1
is compiled, and
compilation continues after the
#endif
.
-Otherwise, if
Cond2
evaluates to
true
,
CodeSection2
is compiled, and compilation
continues after the
#endif
.
This continues until either a condition evaluates to
true
, or all the conditions have
returned
false
. If that is the case, none of the code sections in the construct are
compiled, and compilation continues after the
#endif
.
-
The
#if...#elif...#else
construct works the same way, except that if no condition is
true
, then the code section after the
#else
is then compiled, and compilation continues
after the
#endif
.
Figure 22-2.
The #elif construct