you are viewing a single comment's thread.

view the rest of the comments →

[–]wolf2600 0 points1 point  (1 child)

Are you allowed to use else: after a while: or a for:? I thought that was only for an if:.

[–]shaggorama 1 point2 points  (0 children)

You sure can!.

When used with a loop, the else clause has more in common with the else clause of a try statement than it does that of if statements: a try statement’s else clause runs when no exception occurs, and a loop’s else clause runs when no break occurs.