I believe I've seen this somewhere, but I don't recall if it was a different language, or if I just can't remember the syntax well.
Is there a way to fall through multiple case statements without stating case value: repeatedly?
I know this works:
Switch (value)
{
case 1:
case 2:
case 3:
//do some stuff
break;
case 4:
case 5:
case 6:
//do some different stuff
break;
default:
//default stuff
break;
}
but I'd like to do something like this:
Switch (value)
{
case 1,2,3:
//Do Something
break;
case 4,5,6:
//Do Something
break;
default:
//Do the Default
break;
}
Is this syntax I'm thinking of from a different language, or am I missing something?
Thanks!