Re:Ruby’s Most Underused Keyword
by old-gregg on Saturday February 07, 2009 @12:12AM
(#470816)
Careful here: I've seen plenty of "Rubiomatic" bugs that look like this:
value = function_that_nils or "default"
... which results in nil assignment to value. Accidental confusion between || and 'or' is very common in Ruby world IMO, almost like famous == vs = in C.
Re:Ruby’s Most Underused Keyword
by iamwil on Saturday February 07, 2009 @08:26AM
(#471105)
Agreed. I think one is for statements (or) and the other one is for expressions (||), so they have different operational precedence, even though you could use them interchangeably, as long as you knew what got executed first.
value = function_that_nils or "default"
... which results in nil assignment to value. Accidental confusion between || and 'or' is very common in Ruby world IMO, almost like famous == vs = in C.