I have no problem of putting a break statement in the default option of a switch case statement, just wondering why it is needed. Anyone any ideas?
int a = 42;
switch (a)
{
case 1 :
case 2 : //statements for case 1 and 2
break;
// probably more case here
default:
Console.WriteLine("We are here");
break;
}
If I leave the break out on line 10, I get the error Control cannot fall through from one case label ('default:') to another but as it is the last statement in this situation, I'm a bit puzzled.