Yoda Conditions


  The act of using
  
  if (constant == variable)
  
  instead of
  
  if (variable == constant)
  
  It’s like saying “If blue is the sky”.


Damn, that’s funny.

New Programming Jargon — Global Nerdy

Yoda Conditions

The act of using

if (constant == variable)

instead of

if (variable == constant)

It’s like saying “If blue is the sky”.

Damn, that’s funny.

New Programming Jargon — Global Nerdy

Notes

  1. 5v3n reblogged this from danielpietzsch and added:
    g this is funny for real, but there’s at least one situation where this bares a major pitfall: if ( variable.equals(...
  2. dhotson reblogged this from danielpietzsch and added:
    Is it wrong that I often use both orders in the very same if statement? eg. if (false === ($result = $obj->getResult()))...
  3. danielpietzsch posted this