实验代码:
i=0
while i<10:
i=i+1
print('-'*30)
if i==5:
break #结束整个while循环
print(i)
i=0
while i<10:
i=i+1
print('-'*30)
if i==5:
continue #结束本次循环,直接进入下一循环
print(i)
处理结果:
------------------------------
1
------------------------------
2
------------------------------
3
------------------------------
4
------------------------------
------------------------------
1
------------------------------
2
------------------------------
3
------------------------------
4
------------------------------
------------------------------
6
------------------------------
7
------------------------------
8
------------------------------
9
------------------------------
10