From: Gavin Kistner Date: 2005-08-19T23:59:17+09:00 Subject: Re: Case Expressions and Classes --Apple-Mail-5-127465413 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Aug 19, 2005, at 8:51 AM, Daniel Schierbeck wrote: > Could anyone explain to me why this isn't working? > > # returns 'no' > case :foo.class > when Symbol then > puts 'yes' > else > puts 'no' > end Case statements use ===, not == to compare the value against arguments. The Class#=== operator matches against the class of an object, so you want: case :foo when Symbol then puts 'yes' else puts no end I know, it's sort of confusing. :| --Apple-Mail-5-127465413--