From: tilde Date: 2010-09-03T14:25:12+09:00 Subject: Re: case (variable) when type1 ... when type2 ... end On 08/30/10 10:33, Jean-Julien Fleck wrote: >> how can I write case statement to check of specific type the variable has? >> Something like: > > It simpler: > >> case var >> when :Fixnum >> puts "#{var} is Fixnum" >> when :String >> puts "#{var} is String" >> end > > case var > when Fixnum > puts "#{var} is Fixnum" > when String > puts "#{var} is String" > end > > (no ":") > > Cheers, > Hi, could you explain me why this works? It's a special behaviour of the "case" statment?