J
Jason Lillywhite
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
returns true for any numeric value and false for everything else.
This:
Float(x) rescue false
almost works but doesn't return true on numeric values
in Lisp?
(number? 5) => #t
(number? -0.453) => #t
(number? 'a) => #f
returns true for any numeric value and false for everything else.
This:
Float(x) rescue false
almost works but doesn't return true on numeric values