Yoda condition

<programming> The programming practise of using

 if (constant == variable)

e.g.

 if (4 == foo)

instead of the more natural

 if (variable == constant)

It is named after the Star Wars character Yoda who says things like "Strong is Vader". It may have been invented as a way to prevent coding errors like

 if (count = 5)

(accidentally using a single "=" (assignment) instead of a double "==" (comparison)). The above is syntactically valid whereas the Yoda equivalent would give a compile-time error.

Last updated: 2012-06-25

Try this search on Wikipedia, OneLook, Google

Nearby terms: YMODEM « YMODEM-G « yocto- « Yoda condition » YOL Computers » yotta- » yottabyte


Loading

Copyright Denis Howe 1985

directoryold.com. General Business Directory. http://hotbookee.com.