break continue
break将退出整个循环
l=[3,4,5,6,7,8]
for i in l:
if i ==5:
break
print(i)
3
4
continue将退出当前循环
l=[3,4,5,6,7,8]
for i in l:
if i ==5:
continue
print(i)
3
4
6
7
8
另:内外循环变量不能一样
break将退出整个循环
l=[3,4,5,6,7,8]
for i in l:
if i ==5:
break
print(i)
3
4
continue将退出当前循环
l=[3,4,5,6,7,8]
for i in l:
if i ==5:
continue
print(i)
3
4
6
7
8
另:内外循环变量不能一样