← Back to Blog

Common PASS/CONTINUE/BREAK Mistakes

The problem...

Your loop runs. But it stops too early. Or it never stops. Or it skips everything instead of something.

These are the mistakes almost every beginner makes with pass, continue, and break. At least once.

Mistake 1 — Using pass when you mean continue

# Wrong — pass does nothing, loop prints everything
for letter in "Bull":
    if letter == "u":
        pass
    print(letter)

# B
# u    ← still prints
# l
# l

# Right — continue skips the iteration
for letter in "Bull":
    if letter == "u":
        continue
    print(letter)

# B
# l
# l

pass does nothing — execution continues to the next line. continue skips the rest of the iteration.

Mistake 2 — break without a condition

# Wrong — stops on the very first iteration
for letter in "Bull":
    break
    print(letter)    # never runs

# Right — break with a condition
for letter in "Bull":
    if letter == "u":
        break
    print(letter)

# B

break alone stops the loop immediately on the first iteration. Always pair it with a condition.

Mistake 3 — Code after break or continue

for letter in "Bull":
    if letter == "u":
        continue
    print(letter)        # runs for all letters except "u"
    print("processed")   # also runs — it's after the if block, not after continue
for letter in "Bull":
    if letter == "u":
        continue
        print("skipped")    # never runs — this IS after continue

Only code inside the same block as continue or break is skipped. Code outside that block still runs.

Mistake 4 — Expecting else to run after break

for letter in "Bull":
    if letter == "u":
        break
else:
    print("Done.")    # never runs — break interrupted the loop

else only runs when the loop completes without break. If break fires — else is skipped.

Mistake 5 — continue outside a loop

# Wrong — SyntaxError
if True:
    continue    # continue only works inside a loop

continue and break only work inside loops. Using them outside — SyntaxError.

What's really happening

Most of these mistakes come from one assumption — that pass, continue, and break do similar things. They don't.

pass does nothing. continue skips one iteration. break ends the loop. Three different tools. Three different jobs.

The mindset shift

Stop thinking: "They all interrupt the loop somehow."

Start thinking: "pass holds, continue skips, break stops."

What you should understand now

  • pass does nothing — execution moves to the next line
  • continue skips the rest of the current iteration
  • break stops the loop entirely — always use with a condition
  • else is skipped when break fires
  • continue and break only work inside loops
[ login to bookmark ] // copied! 23 views · 2 min
// resources
Other pass_continue_break_mistakes.py
← prev FOR IF Mini Project — Pig Latin next → pass / continue / break — The Full Picture
// 0 comments
// No comments yet. Be the first.
// leave a comment

// Your comment will appear after approval.