โŒจ๏ธap computer science principles review

If-else statement

Written by the Fiveable Content Team โ€ข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโ€ขWritten by the Fiveable Content Team โ€ข Last updated September 2025

Definition

An if-else statement is a programming construct that allows the program to make decisions based on a condition. It consists of an if block and an else block, where the code inside the if block is executed when the condition evaluates to true, and the code inside the else block is executed when the condition evaluates to false.

Pep mascot

"If-else statement" also found in: