From: Just Another Victim of the Ambient Morality Date: 2006-08-29T11:20:10+09:00 Subject: Re: A newbie question about case and === "Eero Saynatkari" wrote in message news:f6a9600f8e87240669e788b674456558@ruby-forum.com... > Sonny Chee wrote: >> >> I read that the case statement uses the === method for comparison of >> each of its clauses. So, why doesn't the second comparison in the >> following code snippet evaluate identically? >> >> a_fix_num = 1 >> puts a_fix_num.class >> case a_fix_num >> when Integer >> puts 'Yes, this is an Integer subclass' >> else >> puts 'No, this is not an Integer subclass' >> end >> >> if a_fix_num === Integer >> puts 'Yes, this is an Integer subclass' >> else >> puts 'No, this is not an Integer subclass' >> end > > case actually evaluates the other way. > > Integer === a_fix_num # true That is hilarious! It's obvious when you think about it but, otherwise, it's very surprising...