4 ms·
This to me screams "I don't understand boolean variables". Why stop there? switch (byte_value) { case 0: return 0; case 1: return 1; ... cas
by ggambetta 3y ago
This to me screams "I don't understand boolean variables".
Why stop there?
switch (byte_value) {
case 0: return 0;
case 1: return 1;
...
case 255: return 255;
}
- drewcoo 3y agoIt's more about guard clauses. https://en.wikipedia.org/wiki/Guard_(computer_science) https://en.wikipedia.org/wiki/Guard_(computer_science)
- hardware2win 3y agoVisualizing control flow from if ladder effort: minimal Doing the same for not tiny boolean expression: way more Just because you think it is cool cuz profs forced it on ya during college is not a argument
- ajuc 3y agoIt's personal taste. You can subdivide boolean expressions just as easily with if-then-elses as with boolean functions. What most people object to is leaving the last level of if-then-else and returning true or false, when you could have returned simpleBooleanExpression and do away with 1 level of nesting.
- pwdisswordfishc 3y agoIronically, I have had profs tell me to use nested ifs instead of breaking loops, so…
- HaroldBolt78 3y ago[flagged]