Date: Thu, 19 Dec 2024 08:16:42 +0000
> There is no ambiguity: break and continue are not *goto*. There is no such thing as a “goto label” or a “break label” or a “continue label”. There is a label. If the label is a loop or switch header, then continue and break can point to it because they apply to loops. If the label points to a construct for which break or continue are not appropriate it is not valid, this is no different from break or continue being invalid outside of an appropriate control structure.
This is exactly the misconception I have tried to point out to how misleading it is to call it a label. This syntax does not propose to create a "label" in the same way that a "goto label" works. Labels as in goto have no relation to code following it.
What this proposal does is to explicit name a control flow statement (while/do/for/switch) such that you can reference which one you mean top continue or break.
There could be no such thing as a “break label” or a “continue label” because there's only SINGULAR label that marks a unique point in code, and break and continue do not make sense unless in relation to a (while/do/for/switch) where you want to express either going back and re-evaluate the condition before continuing (continue) or to interrupt the flow (break).
Hope this clarifies the difference.
Received on 2024-12-19 08:16:44