I'm partial to for-else-loops. They fit perfectly into languages with compound expression (produce a value from a break in the loop or from the else block).
They don't come up that often, but when they do they're really the best solution.
They don't come up that often, but when they do they're really the best solution.
I've often wanted both a "then" and an "else" from both for and while loops. The "then" would be for a successful completion (no break), and the "else" would be for when the loop doesn't even run a single iteration.
But that didn't make it into our "language budget", unfortunately. It's easy to implement, but hard to argue for when it doesn't get used often
I feel like it would work better with a more explicit keyword, but I don't know which one. `nobreak`?