# 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)

{

&#x20;    \<block of statements>

}

<figure><img src="https://1944349550-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4BNKwhk8txJ3Zd_j4L%2Fuploads%2Fvv9bcX0IVVdmyF54UsYH%2FCapture8.PNG?alt=media&#x26;token=fba25e29-0517-497d-a930-11a06f05323d" alt=""><figcaption></figcaption></figure>

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)

{

&#x20;    \<block of statements>

}

ELSE&#x20;

{

&#x20;    \<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.
