break, continue, and Labeled Loops
Control loops precisely with labels.
Two Loop Controls
Inside any loop, break exits the loop entirely while continue jumps to the next iteration. They give you fine control over flow. 🎛️
break Leaves Now
When break runs, the loop stops immediately and execution resumes on the line right after the loop. Nothing else in the body runs.
for (items) |x| {
if (x == 0) break;
use(x);
}All lessons in this course
- if as a Statement and Expression
- while Loops and continue Expressions
- for Loops over Ranges and Items
- break, continue, and Labeled Loops