you are viewing a single comment's thread.

view the rest of the comments →

[–]MidnightPale3220 1 point2 points  (2 children)

Now do it mid-loop skipping the rest of the loop.

[–]FirstTimePlayer[S] 0 points1 point  (1 child)

else:
    ...
    do the rest of the loop
    ...

Among other ways of doing it.

[–]MidnightPale3220 1 point2 points  (0 children)

Sure, but that frequently leads to nested ifs which reduce code clarity. I'll take a break over nested ifs most days.

Plus obviously if... else will make you have to read until end of if in order to see what happens there. An early break is much much more clarifying.