January 2018
Intermediate to advanced
678 pages
20h 16m
English
if Statement: else and else if ClausesIn the Game Night web page, you were introduced to the simplest form of the if statement—when the if clause is by itself. That form takes care of the case when you want to do something or nothing. But what if you want to do one thing or something else, depending on the value (true or false) of a condition? Or, what if you want to do one thing from among a list of three or more options? In this section, we describe additional forms of the if statement that take care of those situations.
FIGURE 9.9 shows the syntax and semantics for the form of the if statement that takes care of the situation where you want to do one thing or something else. It uses the same if clause at the top that you’ve seen before, ...
Read now
Unlock full access