From: "Jan E." Date: 2012-05-23T00:07:29+09:00 Subject: Re: Disginguishing object types Ian Asaff wrote in post #1061686: > Using a case statement is handy for this > > 1.9.3-p0 :010 > x = 'hi' > => "hi" > 1.9.3-p0 :011 > case x > 1.9.3-p0 :012?> when String > 1.9.3-p0 :013?> puts 'string' #process string > 1.9.3-p0 :014?> when Array > 1.9.3-p0 :015?> puts 'array' #process array > 1.9.3-p0 :016?> default > 1.9.3-p0 :017?> puts 'huh?' > 1.9.3-p0 :018?> end The keyword for the default case is "else", not "default". -- Posted via http://www.ruby-forum.com/.