Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I do not know of the single language, including the language of math, that gives equal precedence to their and and or operators. Sadly Ruby does, and it's a blight on the language. It's like giving equal precedence to + and \. It's a choice, but not one that anyone would expect.

What's worse, Ruby give the "correct" relative precedence to &&/||. I suspect this inconsistency is the reason the OP cautions against using and/or*. It's too bad because I miss the low precedence and/or operators (from perl) that can be used to avoid parenthesis that &&/|| would require in the presence of assignment, etc.



Ruby's and and or are for flow control like if and unless, not binary logic operators like (or synonyms for) && and ||.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: