From: 7stud -- Date: 2007-10-31T10:41:35+09:00 Subject: Re: Newbie Question on Operator Precedence? Z T wrote: > What's the reason? The line: > puts false or true is equivalent to: (puts false) or true puts returns nil, so that statement is equivalent to: nil or true which evaluates to: false or true and the result of that is true--but since you didn't save the result in a variable, it is discarded. Try this: result = (puts false) or true p result --output:-- nil That result may also be surprising. That's because the statement: result = (puts false) or true is equivalent to (result = (puts false)) or true puts returns nil, which gets assigned to result, and the statement becomes: result or true which is equivalent to: nil or true which is equivalent to: false or true which evaluates to true--but since the result isn't stored anywhere, it is discarded. > if false or true That statement is equivalent to: if (false or true) which evaluates to: if true -- Posted via http://www.ruby-forum.com/.