jemnotesversion 2 / featuring this entry or see all/search

Mar 28
Perhaps || should always be used in Ruby in preference to or—I thought it was less attractive than or to look at, but check this out:
puts false or true   # interpreted as puts(false) or true
=> false
puts false || true   # interpreted as puts(false || true)
=> true
I knew that the precedence for or was low in Ruby, but I didn’t realise it was this low.