> For the complete documentation index, see [llms.txt](https://www.csprinciples.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.csprinciples.com/big-idea-3/3.6-conditionals.md).

# 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="/files/hYCLcnxmZZXVU6mnctrq" 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.csprinciples.com/big-idea-3/3.6-conditionals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
