Possible Duplicate:
How to break out of multiple loops in Python?
is it possible to break out of two for loops in Python?
i.e.
for i in range(1,100):
for j in range(1,100):
break ALL the loops!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no nested
breakstatement in python.Instead, you can simplify your function, like this:
.. or put the code into its own function, and use
return:.. or use an exception:
.. or use for-else-continue:
.. or use a flag variable: