Written by the Fiveable Content Team • Last updated August 2025
Verified for the 2026 exam
Verified for the 2026 exam•Written by the Fiveable Content Team • Last updated August 2025
Definition
For loops are control structures used for repetitive execution of code blocks. They consist of an initialization statement, condition statement, increment/decrement statement, and loop body. The loop continues until the condition becomes false.
While Loop: A while loop is another type of control structure that repeatedly executes a block of code as long as a given condition is true.
Nested Loop: A nested loop is a loop inside another loop. It allows for more complex iterations and can be used to traverse multi-dimensional data structures.
Break Statement: The break statement is used within loops to terminate their execution prematurely based on certain conditions.