Fiveable
Fiveable

Loop Condition

Definition

A loop condition is a Boolean expression that determines whether the loop should continue executing or stop. It is evaluated before each iteration of the loop.

Analogy

Think of a loop condition as a traffic light at an intersection. If the light is green, you can keep driving through the intersection (loop continues). But if the light turns red, you must stop and exit the intersection (loop stops).

Related terms

Infinite Loop: An infinite loop is a type of loop where the loop condition always evaluates to true, causing the loop to repeat indefinitely.

Fixed Number of Repetitions: This term refers to a type of loop where the number of iterations is predetermined and fixed before entering the loop.

Iteration: Iteration refers to each individual execution or repetition of a loop.

collegeable - rocket pep

Are you a college student?

  • Study guides for the entire semester

  • 200k practice questions

  • Glossary of 50k key terms - memorize important vocab



© 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.


© 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.