From: Thomas Wieczorek Date: 2008-07-30T15:39:14+09:00 Subject: Re: and and or in case Hello Botp! On Tue, Jul 29, 2008 at 5:25 PM, botp wrote: > > yes, but why the difference in precedence for case-when and if? > shouldn't it be more natural that they be the same? > Yes, I agree with you. I think when and if should act the same, this would follow the principle of least suprise. I think some might have missed the question: Why DOES this work? if 1 == 1 and 2 == 2 puts "OK!" end # => "OK!" Why DOES NOT this work? case when 1 == 1 and 2 == 2 puts "OK!" end syntax error, unexpected kAND, expecting kTHEN or ':' or '\n' or ';' when 1 == 1 and 2 == 2 ^ test.rb:9: syntax error, unexpected kEND, expecting $end The precedence seems to be handled differently with "if" and "when". Regards, Thomas