break switch?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jun 9 16:57:12 PDT 2013
On Monday, June 10, 2013 01:36:25 Timon Gehr wrote:
> On 06/10/2013 01:23 AM, bearophile wrote:
> > ...
> >
> > Do you like? :-)
> >
> > Bye,
> > bearophile
>
> Are you aware that the following works?
>
> void main(){
> import std.stdio;
> enum Foo{foo1,foo2}
> int[5] data;
> Foo f;
> Lswitch:switch(f){
> case Foo.foo1:
> foreach (x;data)
> if(x==10)
> break Lswitch;
> writeln("10 not found.");
> data[0] = 10; // Put the missing 10.
> break;
>
> default:
> break;
> }
> }
Well then, there you go. Problem solved.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list