Skip to content
Exercises · Q3

Q.Differentiate between break and continue statements using examples.

Yanam CbseNCERTSubjective· 3mImportance★★★★★est
67% · 26/39 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

break jumps OUT of the loop altogether; continue jumps back to the TOP of the loop, skipping only the rest of the current iteration — shown by outputs "1 2" vs "1 2 4 5" on the same loop.

The idea. Both are jump statements that alter a loop's normal flow, but their scope of effect differs completely:

Aspectbreakcontinue
EffectTerminates the loop immediatelyEnds only the current iteration
Control goes toFirst statement AFTER the loopThe loop's next test/iteration
Remaining iterationsAbandonedStill executed
Typical useStop searching once found; exit on a sentinel valueSkip unwanted cases (e.g. invalid items) but keep looping

Example 1 — break:

for i in range(1, 6):
    if i == 3:
        break
    print(i)
print("Loop over")
1
2
Loop over

Trace: i=1 prints, i=2 prints, i=3 triggers break — iterations 3, 4, 5 never happen and control lands on the print after the loop.

Example 2 — continue (same loop, one word changed):

for i in range(1, 6):
    if i == 3:
        continue
    print(i)
print("Loop over")
1
2
4
5
Loop over
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.