goto (outer) case

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Mon Feb 18 17:59:37 PST 2013


Consider these nested switches:

---------------------------
enum Foo {a, b}
enum Bar {bar}

auto foo = Foo.a;
auto bar = Bar.bar;

final switch(foo)
{
case Foo.a:
    final switch(bar)
    {
    case Bar.bar:
        XXXXXX
        break;
    }
    break;

case Foo.b:
    break;
}
---------------------------

Without adding extra code anywhere else, is there anything I can stick
in for XXXXXX to get execution to jump to "case Foo.b:"?

Doing "goto case Foo.b;" doesn't work. It just gives a compile error
that a Foo can't be implicitly converted to Bar.

This ability isn't critical, of course, but it would help clean up some
code I have.



More information about the Digitalmars-d-learn mailing list