I know it is terribly inefficient and ugly code, but if I have three for
loops, nested inside each other such as so:
for x in range(0, 10):
for y in range(x+1, 11):
for z in range(y+1, 11):
if ...
I want to break the two inner loops and continue to the next iteration of the outer loop if the if
statement is true. Can this be done?
break
andcontinue
? They are recognised in Python, well in Python 3.4 anyway. – Constantinobreak
/continue
construct, but as I said it was rejected. – Twotime