AP Computer Science Principles

study guides for every class

that actually explain what's on your next test

If-else statement

from class:

AP Computer Science Principles

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.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.