Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
DUDE. RULE ZERO OF SWITCHES.
YOU NEVER, EVER, EEEEEVEEEEER OMIT THE BREAK, EVEN IF ITS PERFECTLY INTENTIONAL AND BEHAVES EXACTLY HOW YOU WANT IT TO.
the only exception is when you do
actual code for both
except this, NEVER EVER.
AL1L35534y@Midnigh-shcode why tho
Noob66504yThat was fun to read!
nhll744yMy personal rule #0 for switch statements: don't use them unless absolutely necessary. Too much incidental complexity.
0. because that's how it should have been designed in the first place. the way it is is basically a branching statement that executes through all the valid leafs unless you explicitly say otherwise, which is stupid. switch should be "branch according to value". if you want "execute if all blocks for which condition is true", we have different constructs for that which are explicit about this. you know, such as series of CONDITIONS.
1. haven't you read the OP?