While we're all familiar with:
switch(x){ case 1: do_something(); break; case 2: do_something_else(); break; default: do_default(); break; } I was wondering if there exists in any language a syntactic variation like this:
switch(x){ case(1){ do_something(); } case(2){ do_something_else(); } default{ do_default(); } } As I write this, I realize that there is no clean way to indicate a certain case is non-breaking, and that program flow should cascade into subsequent cases. Likely that is reason enough, but I was always curious as to why C family languages (I come from PHP) that I've seen in passing abandon the brace syntax for switch construct case statements.
switchhas always piqued my curiosity in "brace-block" languages. +1 for bringing my attention back to it; I'm learningCand as an educational project, I'm writing an interpreter for a simple scripting language I'm creating. Any information is good information!