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
A conditional statement is a programming construct that allows the execution of certain code blocks based on whether a specific condition is true or false.
Related terms
If Statement: An if statement is a type of conditional statement that executes a code block only if a specified condition is true.
A condition is an expression that evaluates to either true or false and determines whether the code block associated with a conditional statement will be executed.
Else Statement: An else statement is used in conjunction with an if statement and provides an alternative code block to execute when the condition in the if statement evaluates to false.