Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
Created October 15, 2010 02:55
Show Gist options
  • Save jeremyBanks/627523 to your computer and use it in GitHub Desktop.
Save jeremyBanks/627523 to your computer and use it in GitHub Desktop.
A simple way to have a loop break with an outer loop in Python.
for x in range(5):
for y in range(10):
if x * y > 20:
print x, y
break # breaks both loops!
else:
continue
break
# Prints "3 7", and nothing else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment