代码如下:
for i in range(1, 6): if i == 3: print('等于3,跳过') continue else: print(i)
1)通过使用 continue 语句跳过代码块中的其余语句;2)continue 语句同样能用于 for 循环