break while; break for; break foreach
Steven Schveighoffer
schveiguy at gmail.com
Thu May 13 19:31:31 UTC 2021
On 5/13/21 3:16 PM, Walter Bright wrote:
> It's an interesting idea.
>
> One of the downsides is when refactoring code, the "break while" may
> suddenly apply to an unintended while. With "break label" that isn't
> going to happen.
True. But this also happens with a non-labeled break statement. But we
may not want to duplicate that pain with a new feature.
Possibly, we could require labels if the target is ambiguous (i.e.
`break while` in a `while` nested in a `while`).
For sure, the most common use case I think is a switch inside a loop or
a loop inside a switch, which should be pretty unambiguous.
-Steve
More information about the Digitalmars-d
mailing list