Python跳出循环 break continue 基础用法
super
2022-12-14 23:59
1508
Python跳出循环 break continue 基础用法
array = [1, 2, 3, 4, 5, 6]
for i in array:
if i == 2:
# 结束本次循环
continue
print(i)
print('=====')
for i in array:
if i == 2:
# 结束整个循环
break
print(i)
0 条讨论