On Sat, Apr 26, 2014 at 03:03:32PM +0200, Philipp A. wrote:
what y’all are missing about switch/case is that it’s *not* necessarily a series of comparisons in most languages.
*Some* people might be missing that, but not *all* of us :-)
Before commenting further, anyone who isn't familiar with the two rejected PEPs on this topic should read them:
Also, folks might like to review the wide range of semantics and syntax for switch/case in different languages:
By my count, there are:
50 languages with no case/switch at all 30 languages using the keyword "case" 19 using "switch" 15 using "select" 3 using "when" 2 using "match" 2 using "given" (treating Perl 5 and 6 as distinct languages) 1 using "evaluate" 1 using "caseof" 1 using "if" (with a switch-like syntax)
The above counts should be mostly accurate, but I don't guarantee that they are exactly correct. Apart from the possibility of counting errors, there were a few cases where I had to make a judgement call on whether or not language feature X was analogous to a switch or not.