3 ms·
I agree. It also really helps when you want to negate something. if(!condition) is a much better read and less prone to errors than trying to negate a long sta
by didgetmaster 4y ago
I agree. It also really helps when you want to negate something.
if(!condition) is a much better read and less prone to errors than trying to negate a long statement inside the if().
This pattern also eliminates duplication. I have fixed bugs in code where the same long if condition was duplicated several times within the same function (probably with cut and paste). This wastes cycles recalculating it each time and runs the risk of changing one of them without changing them all.