6 ms·
>> I remember giving up on Perl when I discovered that || and or were both "or" operators but had different precedences. || has a higher precedence than or in
by llamataboot 10y ago
>> I remember giving up on Perl when I discovered that || and or were both "or" operators but had different precedences.
|| has a higher precedence than or in Ruby as well.
- marshray 10y agoYeah that was one of my favorite features.
- DonHopkins 10y agoAm I totally misunderstanding you, or are actually saying "||" having higher precedence than "or" is one of your favorite features? Ruby features or Perl features? How does that tangibly effect your day to day life? What is your second favorite feature?
- saghm 10y agoAm I the only one who just completely ignores `and` and `or` in Ruby in favor of `&&` and `||`? The boolean keywords do look nicer than the operators, but given that there are some contexts where you can only use the operators, I just don't bother using the keywords at all
- lloeki 10y agoNo: > rubocop -D foo.rb Inspecting 1 file C Offenses: foo.rb:1:3: C: Style/AndOr: Use || instead of or. a or b ^^ 1 file inspected, 1 offense detected