3.6 Conditionals

Enduring Understanding

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

Learning Objective

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

Essential Knowledge

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

Learning Objective

For selection:

a. Write conditional statements.

b. Determine the results of conditional statements.

Essential Knowledge

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

The exam reference sheet provides:

Text:

IF (condition)

{

<block of statements>

}

in which the code in block of statements is executed if the Boolean expression condition evaluates to true; no action is taken if condition evaluates to false.

The exam reference sheet provides:

Text:

IF (condition)

{

<block of statements>

}

ELSE

{

<second block of statements>

}

in which the code in first block of statements is executed if the Boolean expression condition evaluates to true; otherwise, the code in second block of statements is executed.

Last updated