From: nobu.nokada@... Date: 2003-09-03T21:42:46+09:00 Subject: Re: Possible to make compound if statements... Hi, At Wed, 3 Sep 2003 21:06:54 +0900, Joey Gibson wrote: > ||| History lesson: 'and' and 'or' and 'not' are used in > ||| languages like BASIC, Algol, and Pascal. && and || and ! > ||| are used in languages like C, C++, and Java. Ruby happens > ||| to know both forms. > > Also 'and' and 'or' have "extremely low precedence" (according to Ruby in a > Nutshell) so constructs using them _may_ behave differently than those > using && and || and my need parentheses to clear up ambiguities. I don't > have any good examples, but I'm sure someone does. foo = false || bar = true # foo = true, bar = true foo = false or bar = true # foo = false, bar = true The former is equivalent to foo = (false or bar = true) and the latter is (foo = false) || (bar = true) Also note that 'and' and 'or' have same precedence. (foo or bar and bas) means ((foo || bar) && bas) but (foo || bar && bas) is (foo || (bar && bas)) -- Nobu Nakada