switch statement exiting a void function

Jonathan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 16 10:20:14 PDT 2014


> Try:
>
> enum RunOpt { opt1, opt2, opt3 } // No semicolon here
>
> final switch (option) with (RunOpt) {
>     case opt1: fun1(...); break;
>     case opt2: fun2(...); break;
>     case opt3: fun3(...); break;
> }
>
> Bye,
> bearophile

My hero.



More information about the Digitalmars-d-learn mailing list