Comment by fuzztester
3 months ago
Not the same thing (although I thought it was), according to the Python docs, but related:
https://docs.python.org/3/reference/compound_stmts.html
See sections 8.3, the for statement, and 8.2, the while statement.
Yeah, `while...else` in Python does the wrong thing. Executes `else` block when the loop finished normally (not through `break`).
Scala for example has a `breakable {}` block that lets you indicate where you should land after a `break`
However I have no idea how to implement the kind of `else` I described in any language without checking the condition twice.