New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section about Yoda conditions #241
Comments
I don't find anything wrong with 2. and it has specific benefits in many languages because having the constant first avoids this error:
So you'll likely find a lot of people who've had that drummed into them for years and it'll be natural for them to write: (if (= 2 x) ...) (and I do this myself, very deliberately) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider two ways to check what sort of bird we have on hand:
(= bird-type :toucan)
-- one reads this code as "bird type equals toucan"(= :toucan bird-type)
-- you'd read this as "toucan equals bird type"Now while they both do exactly the same thing, the former is the "normal" way to write things and the latter is a Yoda condition
The text was updated successfully, but these errors were encountered: