If you’re in a language that supports it, please don’t use if (false) use if ($disallowAllUsers = false && $whateverTheRealConditionIs)

It seems much worse to use a setter in an if statement.

Think of it as inline attribution/documentation.

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 Octonaut
link
fedilink
61Y
if (true === $wantToCauseErrorsForFun) {
    badOldFunction();
} 
Kogasa
link
fedilink
11Y

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).

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 54 users / day
  • 172 users / week
  • 445 users / month
  • 2.42K users / 6 months
  • 1 subscriber
  • 1.61K Posts
  • 35.6K Comments
  • Modlog