top | item 38690940

(no title)

sinkwool | 2 years 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...

discuss

order

djur|2 years ago

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).