← Python

break and continue

break exits a loop immediately; continue skips the rest of the current iteration and moves to the next

What it does: break exits the loop immediately when the condition is met. continue skips printing when i==2 but the loop continues for other values. continue skips the rest of this iteration and jumps to the next one. break only makes sense inside a loop — Python raises SyntaxError otherwise. break is commonly used to exit a while True: loop based on user input. continue skips even numbers — only odd numbers reach print(). The loop prints 0, 1, 2 then breaks at i==3 before printing 3. Using break and continue to control the flow of a loop.

Common mistakes: break must be INSIDE a loop: it can't be used outside. break must be lowercase Break is not valid Python.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does break do?
Exits the loop immediatelySkips to next iteration
Matches
❌ break
Error: break outside loop
Applying
Meanings
Term
break
Meaning
Immediately exits the entire loop.
Practice
for i in range(10):
Testing
Gaps
Check Answer
Spots
1break
2for i in range(5):

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Kangaroo Rat' badge — Speed Typer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does break do?
A. Exits the loop immediately ✓
B. Skips to next iteration
break completely exits the loop — no more iterations run
2. What does continue do?
A. Exits the loop
B. Skips to the next iteration ✓
continue skips the rest of this iteration and jumps to the next one
3. for i in range(5):\n if i == 3:\n break\n print(i)\nWhat prints?
A. 0, 1, 2 ✓
B. 0, 1, 2, 3
When i reaches 3, break exits — so 3 is never printed
4. for i in range(5):\n if i == 3:\n continue\n print(i)\nWhat prints?
A. 0, 1, 2
B. 0, 1, 2, 4 ✓
continue skips print when i==3 — but the loop continues to 4
5. Can you use break outside a loop?
A. No causes SyntaxError ✓
B. Yes
break only makes sense inside a loop — Python raises SyntaxError otherwise

Match the Pairs

break Error: break outside loop
for i in range(5): continue print(i) Error: print never reached
for i in range(5): if i == 3: break Valid: break exits at i==3
for i in range(5): if i == 2: continue print(i) Ok: Skips printing 2
for i in range(5): if i == 3: break print(i) Output: 0 1 2
for i in range(4): if i == 2: continue print(i) Output: 0 1 3

Key Term

break
Immediately exits the entire loop.~~continue

Fill in the Blanks

1. for i in range(10): if i == 5: break print(i)
2. for i in range(10): if i == 3: continue print(i)
3. while True: x = input('Enter: ') if x == 'quit': break
4. for i in range(10): if i % 2 == 0: continue print(i)
5. for i in range(20): if i == 10: break print(i)

Spot the Error

Question 1
A break
B for i in range(5):
C print(i)
D print('Done')
Line A — break must be INSIDE a loop: it can't be used outside
Question 2
A for i in range(10):
B if i == 5:
C Break
D print(i)
Line C — break must be lowercase Break is not valid Python
Question 3
A for i in range(10):
B if i == 5:
C Continue
D print(i)
Line C — continue must be lowercase Continue is not valid Python
Question 4
A for i in range(10):
B if i == 5:
C break
D print(i)
Line C — break must be indented inside the if block
Question 5
A for i in range(10):
B if i == 5:
C break()
D print(i)
Line C — break is a keyword, not a function don't use parentheses
For Teachers

Create a free class, add this module to a journey, and track who's stuck.

Create a free teacher account →

No credit card. No setup fee. Make a class and invite students in under three minutes.

For Students

Practice this topic interactively, track progress, and unlock badges.

Start Learning Free →

Have a class code?