I like what Perl does: it separates cases by making them look like regular blocks:
given($cat_macro){
when(/OH HAI/){
say "ceiling cat is watching you switch statements";
}
when(/OH NOES/){
die "FAIL";
}
default {
say "<picture of a walrus with a bucket>";
}
}
Pretty easy to follow the control flow, even when they aren't oneliners.
As mentioned in the entry, the idea of having an actual keyword is a bit better than that. In particular, it would make it feasible for a strict notice to be raised if neither keyword was used.
The example implementation loses out on what actually putting it in the language would gain, though: causing an error when forgetting to include next; or break;.
switch in C syntax is terrible implemented, VB done this one so much better. That's one of the reasons why switch is not that popular in C languages (people tend to do crazy if-then-else stuff) and so popular in VB, most devs tries to use select where possible.
switch($some_value) {
case 1 :
doSomething();
case 2 :
doSomething();
break;
case 3 :
doSomethingElse();
break;
default :
doSomething();
doSomethingElse();
}
Is there any reason why keeping things simple is not an option?
The number of possible outcomes in a switch case can often be so many that falling through would just be the route to complicated and difficult to manage code.
"Oh you mean it just keeps going until you break? Okay, duly noted."
Fall through switch is quite useful, and if you really wanted an if-else, you'd use one, right?!