Switch statements should have more than one clause for them to be any more useful over an if-else
construct.
Consider rewriting the switch
as if-else
, thus making the code more readable.
int foo(int bar) {
switch bar {
case 0: {
// ..
} break;
default: {
// ..
}
}
}
int foo(int bar) {
if bar == 0 {
// ..
} else {
// ..
}
}