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
Express an algorithm that uses selection without using a programming language.
For selection:
Write conditional statements.
Determine the result of conditional statements.
For nested selection:
Write nested conditional statements.
Determine the result of nested conditional statements.
Essential Knowledge
Selection determines which parts of an algorithm are executed based on a condition being true or false.
Conditional statements or “if-statements” affect the sequential flow of control by executing different statements based on the value of a Boolean expression.
Nested conditional statements consist of conditional statements within conditional statements.