Thread overview
[Issue 8622] Allow labeled breaks to work on *any* block
Oct 16, 2016
Nick Treleaven
5 days ago
Nick Treleaven
October 15, 2016
https://issues.dlang.org/show_bug.cgi?id=8622

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #5 from Andrei Alexandrescu <andrei@erdani.com> ---
Please formulate this as a DIP if there's interest.

--
October 16, 2016
https://issues.dlang.org/show_bug.cgi?id=8622

--- Comment #6 from Nick Treleaven <nick@geany.org> ---
An alternate syntax which supports `break` without a label is to extend switch:

switch {
  auto x = foo();
  if (x == bar) break;
  auto y = x.baz();
  if (!y) break;
  y.writeln;
}

Here the switch condition defaults to true, and `default:` is implied.

--
May 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8622
Issue 8622 depends on issue 827, which changed state.

Issue 827 Summary: Trying to break out of a labelled BlockStatement breaks out of a for loop at its beginning https://issues.dlang.org/show_bug.cgi?id=827

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WORKSFORME

--
5 days ago
https://issues.dlang.org/show_bug.cgi?id=8622

--- Comment #7 from Nick Treleaven <nick@geany.org> ---
I just discovered that JavaScript actually supports this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label#Using_a_labeled_block_with_break

JS has the same syntax as D for labelled loop break/continue.

--