From: james@... Date: 2002-04-14T01:12:39+09:00 Subject: RE: not vs !, and vs && > -----Original Message----- > From: Guy N. Hurst [mailto:gnhurst@hurstlinks.com] > > Meanwhile, 'true' is an expression and '!true' is an expression, but > combining them with 'and' forms a statement. > (combining them with '&&' would have formed another expression directly) So, 'and' and '&&' are *not* synonyms that differ only in precedence? (Likewise for '!' and 'not' ) > > You must enclose a ruby statement in parentheses to form a ruby > expression. > > puts( (true and !true) ) > puts( (not true) ) > > This demonstrates the slight difference between a ruby 'statement' > and a ruby 'expression'. Statements must be enclosed in parentheses > to form an expression, which is required for using them as an argument. In this example: #----------------------------------- def nt puts "Inside nt" not true end put nt # Prints 'Inside nt', then 'false' #----------------------------------- Why does the last line of the method nt act as an expression? Thanks, James > > > Guy N. Hurst >