hairinmybellybutt@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agoadvancedlemmy.worldimagemessage-square16fedilinkarrow-up1289arrow-down19
arrow-up1280arrow-down1imageadvancedlemmy.worldhairinmybellybutt@lemmy.world to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square16fedilink
minus-squarexmunk@sh.itjust.workslinkfedilinkarrow-up8arrow-down1·1 year agoIf you’re in a language that supports it, please don’t use if (false) use if ($disallowAllUsers = false && $whateverTheRealConditionIs)
minus-squarePlexSheep@feddit.delinkfedilinkarrow-up4·1 year agoNever seen this, what language or buildsystem is this?
minus-squarexmunk@sh.itjust.workslinkfedilinkarrow-up2·edit-21 year agoThat specific language is PHP, but the tip is applicable in any language that supports inline assignment.
minus-squareThe Octonaut@mander.xyzlinkfedilinkarrow-up6·1 year agoif (true === $wantToCauseErrorsForFun) { badOldFunction(); }
minus-squareKogasa@programming.devlinkfedilinkarrow-up1·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).
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).