Thread overview
Are the below statements equivalent?
Dec 26, 2018
Machine Code
Dec 26, 2018
Adam D. Ruppe
Dec 27, 2018
Machine Code
December 26, 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?
December 26, 2018
On Wednesday, 26 December 2018 at 17:33:13 UTC, Machine Code wrote:
> Are the below statements equivalent?

Yes, it is defined here:

https://dlang.org/spec/statement.html#switch-statement

(#2 in the list)
December 27, 2018
On Wednesday, 26 December 2018 at 18:03:44 UTC, Adam D. Ruppe wrote:
> On Wednesday, 26 December 2018 at 17:33:13 UTC, Machine Code wrote:
>> Are the below statements equivalent?
>
> Yes, it is defined here:
>
> https://dlang.org/spec/statement.html#switch-statement
>
> (#2 in the list)

Thanks!