Generalize `elif-else` to all compound statements

Note that else in the if statement, in a loop statement and in the try statement are three very different things.

  • else after if is executed if the if condition is false.
  • else after a loop is executed if no break was executed in the loop body.
  • else after try is executed if no exceptions were raised in the try block.

It is coencidence that the same keyword is used in these cases. Maybe if Guido had used Dutch words, they would have been three different keywords.

2 Likes