首页 > 代码库 > continue和break的区别

continue和break的区别

技术分享
for i in range(10):
    if i < 5:
        continue#跳出本次循环  break跳出整个循环
    print(i)
View Code

continue是跳出本次循环,break是本层循环。

continue和break的区别