The Boolean Expression is an expression that
evaluates to be either true or false.
This second Boolean Expression is evaluated only if
the first Boolean Expression is false.
If this second Boolean Expression is true the code
associated with it will be executed. (STATEMENT B)
If this second Boolean Expression is false, the code
associated with the else will be executed instead.
(STATEMENT C)
Example:
if (num == 0) if (BOOLEAN 1)
printf ("num equals 0\n"); STATEMENT A
else else
if (num < 0) if (BOOLEAN 2)
printf ("num is negative\n"); STATEMENT B
else else
printf ("num is positive\n"); STATEMENT C
In the example above, the second Boolean Expression is:
(num < 0)
If it is true, the code to execute is:
printf ("num is negative\n");
If it is false, the code to execute is:
printf ("num is positive\n");
What the above code represents logically is a three-way
decision, and to show this visually, the indentation is
often arranged as follows:
if (num == 0) if (BOOLEAN 1)
printf ("num equals 0\n"); STATEMENT A
else if (num < 0) else if (BOOLEAN 2)
printf ("num is negative\n"); STATEMENT B
else else
printf ("num is positive\n"); STATEMENT C