re: A New Coding Style for Switch Statements in JavaScript/TypeScript VIEW POST

TOP OF THREAD FULL DISCUSSION
re: This works when each case is discreet (having its own scope), ie each case terminates the switch with a break. But one of the features of switches ...
 

Oh man, I love when I do a little further research and find out that the thing I'm talking about has a huge debate associated with it.

en.wikipedia.org/wiki/Fallthrough_...

en.wikipedia.org/wiki/Duff%27s_device

So it may be the case that your suggested syntax adds extra reinforcement for fall-through to be avoided as an intentional design practice.

 

You beat me to my own argument 😉

That said, I myself have also used fall-through statements on rare occasions.

That that said (is that a thing?), scoping each case using {} doesn't prevent you from falling through case statements anyways.

code of conduct - report abuse