--20cf307f35283c696504a296860a
Content-Type: text/plain; charset=ISO-8859-1

On Fri, May 6, 2011 at 1:18 AM, Super Goat <ruby-forum / sgoat.33mail.com>wrote:

> Thanks everyone for taking the time to reply!
>
> The reason I had 'rand(100).to_i' and 'random.to_i' is because in IRB it
> told me it was a Fixnum.  Also, I had just figured out why my operators
> weren't working so I wanted everything to be an integer.  Obviously, in
> retrospect, I see now that I didn't have to do it that way.
>
>
In OOP, classes can inherit functionality from other classes. There are
several kinds of Integers, Fixnum is one of them, Bignum is another (okay,
actually, those are the only two).

1.class             # Fixnum
1.kind_of? Integer  # true
Fixnum.ancestors    # [Fixnum, Integer, Numeric, Comparable, Object,
Kernel, BasicObject]

n  0**1000
n.class             # Bignum
n.kind_of? Integer  # true
Bignum.ancestors    # [Bignum, Integer, Numeric, Comparable, Object,
Kernel, BasicObject]

--20cf307f35283c696504a296860a--