break while; break for; break foreach
sighoya
sighoya at gmail.com
Thu May 13 17:34:06 UTC 2021
On Thursday, 13 May 2021 at 16:55:18 UTC, Steven Schveighoffer
wrote:
> Wouldn't it be nice to just have this implicit, and allow
> `break keyword;` where keyword is one of `for`, `while`,
> `foreach` and even `switch`?
I think yes. What about lexical non-local returns?
> Does this make sense as a language feature? I believe it
> doesn't break (no pun intended) any code since you currently
> can't have a keyword in that position.
The problem is if you have nested ifs, whiles or fors, wouldn't
it be better then to annotate them and likewise the
break/continue/return keyword?
Kotlin does it similar:
https://blog.mindorks.com/learn-kotlin-returns-jumps-labels
More information about the Digitalmars-d
mailing list