Is it a number : instance_of « Reflection « Ruby
- Ruby
- Reflection
- instance_of
Is it a number
x = 1 # This is the value we're working with
x.instance_of? Fixnum # true: is an instance of Fixnum
x.instance_of? Numeric # false: instance_of? doesn't check inheritance
Related examples in the same category