也许标题有点令人困惑,但你会理解我在代码中的含义:
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
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
我怎样才能使这个工作?
提前谢谢。
答案 0 :(得分:4)
设置一个标志,突破内循环,检查主循环中的标志,然后继续。
for i = 1 to N do
flag = false
for j = 1 to M do
...
if condition then
flag = true
break
...
if flag then continue
...