stackyFACTS
Technology

Why programmers write conditions like Yoda

HERE’S THE INTERESTING PART

Normally, developers write 'if variable equals five'. A Yoda condition forces the completely inverted structure of 'if five equals variable'. It is aggressively unnatural to read, but it brilliantly prevents accidental reassignment of data, forcing programmers to sound like an ancient alien monk just to avoid typos.

Why programmers write conditions like Yoda
STACKY / Technology
One discovery leads to another.

Keep exploring facts in this topic.

Technology →
STACKY FOR IPHONE

A bigger world.
One discovery
at a time.

Keep discovering with Stacky. Interesting facts in an app that is always within reach.

Download on the App Store
ONE MORE DISCOVERY?

Keep exploring

All in this topic →
StackyMore discoveries in the app
Download on the App Store