2.2 Selection

Enduring Understanding

      • The way statements are sequenced and combined in a program determines the computed result. Programs incorporate selection constructs to make decisions to handle varied input values.

Essential Questions

      • How can we store data in a program to solve problems?

      • What might happen if you completed the steps in your regular morning routine to get ready and go to school in a different order? How might the reordering affect the decisions you make each morning?

      • How do video games group different actions for a player based on what key is pressed on the keyboard or controller? How do apps group different actions together based on user interaction, such as pressing buttons?

      • What types of problems can be solved more easily with a computer, and what types can be solved more easily without a computer? Why?

Lesson Objectives

  1. Express an algorithm that uses selection without using a programming language.

  2. For selection:

    • Write conditional statements.

    • Determine the result of conditional statements.

  3. For nested selection:

    • Write nested conditional statements.

    • Determine the result of nested conditional statements.

Essential Knowledge

  1. Selection determines which parts of an algorithm are executed based on a condition being true or false.

  2. Conditional statements or “if-statements” affect the sequential flow of control by executing different statements based on the value of a Boolean expression.

  3. Nested conditional statements consist of conditional statements within conditional statements.