

"Yoda Conditions", "Pokémon Exception Handling" and other programming classics - damian2000
http://www.dodgycoder.net/2011/11/yoda-conditions-pokemon-exception.html

======
heyitsnick
It's a shame it didn't mention the _reason_ for Yoda Conditions: as a
protection against accidentally using the assignment operator rather than a
check for equality. Accidentally writing if (foo=4) { } will not raise an
exception, whereas if (4=foo) {} does, thus alerting you of your typo rather
than allowing a rather nasty bug to persist.

~~~
cperciva
Of course, any compiler written in the past decade should print a warning on
_if (foo = 4)_ , so this reason doesn't apply much any more.

------
ekidd
This post is copied from a famous StackOverflow thread, including the
pictures: [http://stackoverflow.com/questions/2349378/new-
programming-j...](http://stackoverflow.com/questions/2349378/new-programming-
jargon-you-coined)

