I have a switch statement such as the one below:
switch (condition)
{
case 0:
case 1:
// Do Something
break;
case 2:
// Do Something
case 3:
// Do Something
break;
}
I get a compile error telling me that Control cannot fall through from one case label ('case 2:') to another
Well... Yes you can. Because you are doing it from case 0:
through to case 1:
.
And in fact if I remove my case 2:
and it's associated task, the code compiles and will fall through from case 0:
into case1:
.
So what is happening here and how can I get my case statements to fall through AND execute some intermediate code?