@hairinmybellybutt to Programmer [email protected]English • 1 year agoadvancedimagemessage-square32arrow-up1436arrow-down114
arrow-up1422arrow-down1imageadvanced@hairinmybellybutt to Programmer [email protected]English • 1 year agomessage-square32
minus-square@[email protected]linkfedilink8•1 year agoIf you’re in a language that supports it, please don’t use if (false) use if ($disallowAllUsers = false && $whateverTheRealConditionIs)
minus-square@[email protected]linkfedilink5•1 year agoNever seen this, what language or buildsystem is this?
minus-square@[email protected]linkfedilink3•edit-21 year agoThat specific language is PHP, but the tip is applicable in any language that supports inline assignment.
minus-squareThe Octonautlinkfedilink6•1 year agoif (true === $wantToCauseErrorsForFun) { badOldFunction(); }
minus-squareKogasalinkfedilink1•1 year agoThe assignment syntax is too close to comparison, which is what is more typical in that position. I would recommend const bool _isFeatureEnabled = false; if (_isFeatureEnabled && ...) if not a proper feature flag (or just remove the code).
minus-square@[email protected]linkfedilink0•1 year agoThink of it as inline attribution/documentation.
If you’re in a language that supports it, please don’t use
if (false)
useif ($disallowAllUsers = false && $whateverTheRealConditionIs)
Never seen this, what language or buildsystem is this?
That specific language is PHP, but the tip is applicable in any language that supports inline assignment.
The assignment syntax is too close to comparison, which is what is more typical in that position. I would recommend
const bool _isFeatureEnabled = false; if (_isFeatureEnabled && ...)
if not a proper feature flag (or just remove the code).
It seems much worse to use a setter in an if statement.
Think of it as inline attribution/documentation.