@[email protected] to Programmer [email protected]English • 2 years agoadvancedlemmy.worldimagemessage-square31fedilinkarrow-up1423
arrow-up1423imageadvancedlemmy.world@[email protected] to Programmer [email protected]English • 2 years agomessage-square31fedilink
minus-square@[email protected]linkfedilink11•2 years agoIf you’re in a language that supports it, please don’t use if (false) use if ($disallowAllUsers = false && $whateverTheRealConditionIs)
minus-squareKogasalinkfedilink1•2 years 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]linkfedilink6•2 years agoNever seen this, what language or buildsystem is this?
minus-square@[email protected]linkfedilink3•edit-22 years agoThat specific language is PHP, but the tip is applicable in any language that supports inline assignment.
minus-squareThe Octonautlinkfedilink6•2 years agoif (true === $wantToCauseErrorsForFun) { badOldFunction(); }
minus-square@[email protected]linkfedilink1•2 years agoIt seems much worse to use a setter in an if statement.
minus-square@[email protected]linkfedilink1•2 years 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)
The assignment syntax is too close to comparison, which is what is more typical in that position. I would recommend
if not a proper feature flag (or just remove the code).
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.
It seems much worse to use a setter in an if statement.
Think of it as inline attribution/documentation.