advanced
advanced
advanced
You're viewing a single thread.
If you're in a language that supports it, please don't use if (false)
use if ($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.
if (true === $wantToCauseErrorsForFun) { badOldFunction(); }
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.