From: "Peña, Botp" Date: 2002-11-22T11:23:51+09:00 Subject: Re: difference between "and" and "&&" Hi sir Gavin Sinclair [mailto:gsinclair@soyabean.com.au]: You wrote: > No, but other languages don't typically have 'and' and '&&'. > So yes, '=' has a low precedence, but 'and' is lower. To > achieve your example you use '&&'. If Ruby had no 'and' it > wouldn't be confusing. Likewise if 'and' was just sugar for > '&&'. AFAIK, no other langugage is like Ruby in this regard, > so it's bound to be confusing at least once. I believe Matz > has designed it correctly, though. 'and' and '&&' are subtly > different and can be used to communicate different programmer intent: > > result = value && value.size > param = param || default_value > action() and consequent_action() > action() or alternative_action() > > Without *thinking* about precedence, the code above just > reads nicely: the subtleties of the intended high-level > intention are communicated very well through the symbols used. Very cleary explained, sir Gavin. Many thanks. > Gavin kind regards, -botp