
In general, you should always use `||` and `&&`. Except for expressions like follows: system "false" or raise "False return value" Note how you don't need any parentheses in this case, but you would if you used `||` or `&&`. Think of `or` and `and` more like how you think about `if` or `unless` (as in, all 4 are for control flow). In fact, all `||`, `&&`, `or`, `and` under the hood work exactly the same (except for the priority). It's rather that the verbose ones were designed for the usecase I wrote about. On Sat, 2024-02-17 at 20:04 +0100, Information via ruby-talk wrote:
Hi
p(1 and 2 or 3 and 4)
1. how many brackets do we need?
2. in my opinion the result should be 2, not 4.
What do you think?
Andreas
______________________________________________ ruby-talk mailing list -- ruby-talk@ml.ruby-lang.org To unsubscribe send an email to ruby-talk-leave@ml.ruby-lang.org ruby-talk info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-talk.ml.ruby-lang.org...