+ 3
Let's say you have a loop that runs 10 times. Now we're in round 5. If you have a break statement now, the loop will stop here. If you have a continue statement instead, the loop will directly jump into the next round. # only 0, 1, 2, 3 are printed for i in range(10): if i==4: break else: print(i) # 0, 1, 2, 3, 5, 6, 7, 8, 9 are printed for i in range(10): if i==4: continue else: print(i)
2nd Apr 2019, 11:39 AM
HonFu
HonFu - avatar