continue与break

continue 终止当前循环,开始下一次循环

count = 1
while count < 10:
    count = count + 1
    print(count)
    continue              #continue下的输出123不执行
    print("123")
print("end")

break 终止所有循环

count = 1
while count < 10:
    count = count + 1
    print(count)
    break               #break下的输出123不执行
    print("123")
print("end")    

 

posted on 2020-05-31 17:47  Yangyl_00  阅读(105)  评论(0编辑  收藏  举报

导航