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 code block refers to one or more lines of code enclosed in curly braces "{ }". It groups statements together to perform a specific task or control the flow of execution.
A "while loop" is another type of code block that repeats a set of instructions as long as a specified condition remains true.
switch statement: A "switch statement" is yet another type of code block that executes different sets of instructions based on the value of an expression.