0
what is the difference between these codes?
i = 0 while True: i = i + 1 if i == 3 print(âSkipping 3â) continue if i == 5: print(âBreakingâ) break print(i) print(âFinishedâ) and i = 0 while True: print(i) i = i + 1 if i == 3 print(âSkipping 3â) continue if i == 5: print(âBreakingâ) break print(âFinishedâ) why do I have both of Skipping3 and 3 outputs if âprint(i)â is in front of if statements? :))
1 Answer
+ 5
'continue' sends execution control to the first line of the loop, which is where print(i) would be if you place it in front of the if statements.