I have a problem using switch statement when I tried to deal with a special situation. For example, I have 3 cases: A, B, C.
Why not nest the switch into the if statement? there is no-repeat code this way.
if(!C){
statement_3;
switch(variable){
case A:
statement_1;
break;
case B:
statement_2;
break;
}
or make use of both the if-statement and the switch?
if(!C){
statement_3;
}
switch(variable){
case A:
statement_1;
break;
case B:
statement_2;
break;