“一个小例子, 让你再也不头痛break和continue的区别。”
if __name__ == '__main__':
print("continue:")
for i in range(5):
print(f"-------这是第{i+1}次循环")
if i == 2:
continue
print(f"*******我是{i}啊")
print("break:")
for i in range(5):
print(f"-------这是第{i+1}次循环")
if i == 2:
break
print(f"*******我是{i}啊")