0Pricing
Zig Academy · Lesson

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

  1. if as a Statement and Expression
  2. while Loops and continue Expressions
  3. for Loops over Ranges and Items
  4. break, continue, and Labeled Loops
← Back to Zig Academy