October 2004
Beginner
408 pages
9h 24m
English
The if conditional is useful in its own right, but it can be greatly expanded on by using the additional else and else if clauses. The syntax of the if-else conditional is
if (condition) {
/* Do whatever. */
} else {
/* Do this instead. */
}
Note that the else statements take place if the main condition is not true. In other words, the else acts as the default response (Figure 4.5).

The else if clause takes this a step further by letting you set a secondary condition to check for if the initial one turns out to be false (Figure 4.6 ...
Read now
Unlock full access