This is an automated archive made by the Lemmit Bot.

The original was posted on /r/programminglanguages by /u/Dan13l_N on 2024-10-08 17:27:46+00:00.


As we all know, most classic programming languages have the break statement which prematurely exits a for or while loop. Some allow to break more than one loop, either with the number of loops, labels or both.

But is there a language which has a block statement that doesn’t loop, but can be broken, as an alternative to goto?

I know you can accomplish this with switch in many languages and do while, but these are essentially tricks, they aren’t specifically designed for that. The same as function and multiple returns, this is another trick to do that.