3 ms·
You don't need "else". if (x) then: doSomething(); if (!x) then: doOtherThing(); "Else" is a redundant construct, but it's nice to have for sure. I would
by anonytrary 6y ago
You don't need "else".
if (x) then: doSomething();
if (!x) then: doOtherThing();
"Else" is a redundant construct, but it's nice to have for sure. I would prefer not writing the above code.
- o_nate 6y agoThis doesn't work like "else" if doSomething() can change the value of x.
- anonytrary 6y agoThat's true! You could cache x as a constant beforehand, but again super ugly.