0Pricing
Mojo Academy · Lesson

break, continue, and Early Exit

Control loops precisely.

Steer a Loop Precisely

Sometimes you must leave a loop early or skip a single pass. Mojo gives you break and continue for exactly that control. 🎛️

Stop Early with break

The break statement exits the loop immediately. No further passes run, and execution jumps to the code after the loop.

for i in range(10):
    if i == 3:
        break

All lessons in this course

  1. Making Choices with if/else
  2. Looping with while
  3. Iterating with for and range
  4. break, continue, and Early Exit
← Back to Mojo Academy