Summary: Multiway Decisions
This lesson summarizes the major points made in this chapter.
- An
if
statement can contain otherif
statements. Together, suchif
statements are said to be nested. - When an
else
clause contains anif
statement, it often is clearer to write the clause as anelse if
clause. Such a construct is a multiwayif
statement that provides several mutually exclusive choices. - In the absence of braces, an
else
clause is paired with the nearest preceding unmatchedif
. - A
switch
statement provides multiple courses of action according to the value of an expression whose data type is integer, character, enumerated, orString
.
Get hands-on with 1400+ tech skills courses.