Timeline for Why do we have to use break in switch?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 12, 2017 at 21:19 | comment | added | Mike 'Pomax' Kamermans | I know it's not, but given why people get confused over this kind of code, it should absolute explain what that "and" is, because relying on someone to guess "natural and" vs. "logical end" in an answer that only works when precisely explained, needs more explanation in the answer itself, or a rewrite of the function name to remove that ambiguity =) | |
| Dec 12, 2017 at 20:13 | comment | added | Panzercrisis | In other words, doSomething[ThatShouldBeDoneInTheCaseOf]1And[InTheCaseOf]2(). It's not referring to logical and/or. | |
| Dec 12, 2017 at 20:10 | comment | added | Mike 'Pomax' Kamermans | Late to the party, but this is absolutely not "1 and 2" as the function name suggests: there are three different states that can all lead to the code in case 2 triggering, so if we want to be correct (and we do) the real function name would have to be doSomethingBecause_1_OR_2_OR_1AND2() or something (although legitimate code in which an immutable matches two different cases while still being well-written code is virtually nonexistent, so at the very least this should be doSomethingBecause1or2()) | |
| Dec 18, 2014 at 16:00 | history | edited | Panzercrisis | CC BY-SA 3.0 | deleted 167 characters in body |
| Dec 18, 2014 at 15:53 | history | answered | Panzercrisis | CC BY-SA 3.0 |