From: Justin Collins Date: 2008-06-17T11:48:55+09:00 Subject: Re: print(true and true) #=> the parenthesis issue hakunin wrote: > The parenthesis have been discussed before, but maybe this is another > angle. In a nutshell: > > print(true and true) # => throws the following: > > SyntaxError: compile error > (irb):14: syntax error, unexpected kAND, expecting ')' > print(true and true) > ^ > from (irb):14 > > print (true and true) # => works. (notice the space) > > It looks obvious that the only parenthesis around the method args are > containing the expression to be evaluated, so why would this cause > ambiguity? Especially strange that the incorrect way - with the space > - works as expected. Is there any fix in the works? Anything done > about this? > > Thanks! > > print (true and true) is not incorrect, it is just using parentheses for a different purpose. What you are seeing is just a precedence issue, because "and" and "or" have very low precedence. Compare: print(true && true) print(true or true) print(true || true) print((true and true)) print((true or true)) Maybe you already knew that, though? -Justin