Possible Duplicate:
Python: Continuing to next开发者_JAVA技巧 iteration in outer loop
Maybe the title is kind of confusing but you will understand what i mean in the code:
for item in items: #i want to skip one loop of this bucle
for i in item: #loop nº2
if i==5:
continue #but this only skip a loop in nº2, there's no propagation
How can i get this to work? Thanks in advance.
Set a flag, break out of the inner loop, check the flag in the main loop, and continue as appropriate.
for i = 1 to N do
flag = false
for j = 1 to M do
...
if condition then
flag = true
break
...
if flag then continue
...
精彩评论