Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
olback109815yI do that as well sometimes. Instead of a bunch of if-else one could write:
@highlight
switch (true) {
case thing1(): { ... }
case thing2(): { ... }
case thing3(): { ... }
default: { ... }
} -
@olback if-else is more efficient in this case. Also, most languages only support compile-time constants as case values.
-
@s0LA By optimising it on hardware level. That's nearly as good as optimising the idle task of an operating system. :-)
-
COBOL has support for reverse switch-case. This can sometimes be useful if one three different variables can have one specific value.
@highlight
EVALUATE "Y"
WHEN VARIABLE-1 ...
WHEN VARIABLE-2 ...
WHEN VARIABLE-3 ...
WHEN OTHER ...
END-EVALUATE -
It's OK, he just wrote future-proof content for when you port your software to a system that supports qubits.
Related Rants
-
BobbyTables7*looks at data in database* This float column seems wierd. The fractional parts are never above .59 *reality...
-
programmatical2i am fucking tired of companies that come to me expecting to magically fix their STEAMING PILE OF BULLSHIT AND...
-
BobbyTables13Previous front end dev apparently was not aware of padding and margin. The html is riddled with and <b...
Previous dev created a switch statement on a boolean flag. WTF
rant
previous dev