From: Ralph Shnelvar Date: 2010-08-30T20:01:27+09:00 Subject: Re: case (variable) when type1 ... when type2 ... end ------------D3BEC11BF95245 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Eugen, Monday, August 30, 2010, 12:39:36 AM, you wrote: EC> Hi all, EC> how can I write case statement to check of specific type the variable has? EC> Something like: EC> case var EC> when :Fixnum EC> puts "#{var} is Fixnum" EC> when :String EC> puts "#{var} is String" EC> end EC> I tried this also EC> case var.class EC> when 'Fixnum' EC> puts "#{var} is Fixnum" EC> when 'String' EC> puts "#{var} is String" EC> end EC> but ruby refuses to understand me :( EC> What is the best way to write conditional that depends of variable type? EC> Thank you! You were very close. case var when Fixnum puts "#{var} is Fixnum" when String puts "#{var} is String" end Ralph ------------D3BEC11BF95245--