break会跳出条件为True的循环,跳出循环体,如下例子:
for i in range(10):
if i % 2 != 0:
print(i)
break
i += 2
print(i)
2
1
continue中止本轮循环,条件为True的时候才开始下一轮循环,如下例子:
for i in range(10):
if i % 2 != 0:
print(i)
continue
i += 2
print(i)
2
1
4
3
6
5
8
7
10
9