Are the below statements equivalent?

Machine Code jckj33 at gmail.com
Wed Dec 26 17:33:13 UTC 2018


Give:

enum Foo { a, b, c, d, e }
Foo f = Foo.c;

Are the below statements equivalent?

switch(f) {
     case Foo.a:
     case Foo.b:
          doSomething();
     break;
    // ...
}

and:

(note the comma in the case)

switch(f) {
    case Foo.a, Foo.b: doSomething(); break;
    // ...
}

I found it in some source code, tested and it does work but is 
this the standard behavior?


More information about the Digitalmars-d-learn mailing list