[Issue 8622] Allow labeled breaks to work on *any* block

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 16 12:41:14 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=8622

--- Comment #6 from Nick Treleaven <nick at 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.

--


More information about the Digitalmars-d-bugs mailing list