Hacker News new | ask | show | jobs
by sinkwool 907 days ago
`and`, `or`, `not` have much lower precedence than `&&`, `||` and `!` . I would just avoid `and` and `or` in general.

For some more explanation see https://graceful.dev/courses/the-freebies/modules/ruby-langu...

1 comments

Rubocop forbids the use of `and` and `or` in a value expression for this reason, and I believe several style guides used with Rubocop ban them entirely. I like them but have come to accept that they're more trouble than they're worth (in a shared codebase with lots of contributors, at least).