« Back to home

"Yoda" Conditions

Here’s a creative idea I’d never considered before. I’ve written code like this, but accidentally, and then it looks wrong so I change it back. Here’s a quick example: if ( 42 == myInt ) as opposed to if ( myInt == 42 ) The former may be better to use because occasionally we all forget to put that second “=” in there, and we accidentally turn our comparison operator into an assignment operator.…

Read more »