Summary: Multiway Decisions

This lesson summarizes the major points made in this chapter.

  • An if statement can contain other if statements. Together, such if statements are said to be nested.
  • When an else clause contains an if statement, it often is clearer to write the clause as an else if clause. Such a construct is a multiway if statement that provides several mutually exclusive choices.
  • In the absence of braces, an else clause is paired with the nearest preceding unmatched if.
  • A switch statement provides multiple courses of action according to the value of an expression whose data type is integer, character, enumerated, or String.

Get hands-on with 1200+ tech skills courses.