From: Marko Schulz Date: 2001-04-27T15:34:17+09:00 Subject: [ruby-talk:14299] Re: || .. or Question On Fri, Apr 27, 2001 at 09:51:25AM +0900, Yukihiro Matsumoto wrote: > Hi, > > In message "[ruby-talk:14268] Re: || .. or Question" > on 01/04/27, Marko Schulz writes: [ Original problem: 'puts (n == 3 or n == 5)' gives a parse error, 'puts (n == 3 || n == 5)' does work as expected. ] > |Why is 'n == 3 or n == 5' not an expression? And > |why is 'n == 3 || n == 5' on the other hand one? > > Simply precedence reason. In Ruby, statements are expressions that > can't be fit in argument list. Does this mean, that Ruby has an 'list operator' similar to perl with precedence between '||' and 'or'? Otherwise I still don't understand how precedence comes in here. And I didn't read this in 'Programming Ruby' yet. > print a or b #=> print(a) or b > print a || b #=> print(a||b) That case is quite clear. The trouble strikes with parenthesis around the 'a or/|| b'. Looks like other languages do an implicit expression grouping for method arguments with parenthesis around them. I find this to be the expected behaviour too. Does anybody see incompatibilities if this was done in ruby too? Other objections? -- marko schulz Dieser Satz beinhalten drei Fehller.