Saji N. Hameed
3/17/2009 4:56:00 AM
> Is there a way to check for numeric in Ruby similar to the way you can
> in Lisp?
>
> (number? 5) => #t
> (number? -0.453) => #t
> (number? 'a) => #f
irb(main):021:0> (10/3.0).is_a? Numeric
=> true
irb(main):022:0> (10/3).is_a? Numeric
=> true
irb(main):023:0> "a".is_a? Numeric
=> false
saji
--
--
Saji N. Hameed
APEC Climate Center +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 saji@apcc21.net
KOREA