On Tue, Jun 17, 2008 at 9:44 AM, Michael Ulm <michael.ulm / isis-papyrus.com> wrote: > This one really puzzles me. I know of the operator precedence > hierarchy in Ruby, but this doesn't seem to help me figure > out why the parser gets confused here. Could someone give > some insights in the thought process of the parser when it > encounters "print(true and true)" ? The parser doesn't get confused; this is in there totally deliberately. I don't have Ruby's parser handy here, but I think Ruby only allows expressions as parameter if they can go on the right hand side of an assignment. If you want "true and true" on the right hand side of an assignment, you need parentheses as well, because otherwise "a = true and true" is interpreted as "(a = true) and true". Other things that don't go as arguments unless parenthesized: semicolons, control statements, statement modifiers, etc. Everything that operates on statements really. To me, "or" and "and" are not equivalents of "||" and "&&"; the difference in precedence is a definite hint here. While "||" and "&&" work on expressions, "or" and "and" work on statements. If you don't use them as "statement operators", you're bound to run into trouble and you'll have to put extra parentheses all over. Peter