Class Integer
In: numeric.c
Parent: Numeric

Integer is the basis for the two concrete classes that hold whole numbers, Bignum and Fixnum.

Methods

ceil   chr   downto   floor   induced_from   integer?   next   round   succ   times   to_i   to_int   truncate   upto  

Included Modules

Precision

Public Class methods

Public Instance methods

Returns a string containing the ASCII character represented by the receiver’s value.

   65.chr    #=> "A"
   ?a.chr    #=> "a"
   230.chr   #=> "\346"

Iterates block, passing decreasing values from int down to and including limit.

   5.downto(1) { |n| print n, ".. " }
   print "  Liftoff!\n"

produces:

   5.. 4.. 3.. 2.. 1..   Liftoff!

Always returns true.

Returns the Integer equal to int + 1.

   1.next      #=> 2
   (-1).next   #=> 0

Returns the Integer equal to int + 1.

   1.next      #=> 2
   (-1).next   #=> 0

Iterates block int times, passing in values from zero to int - 1.

   5.times do |i|
     print i, " "
   end

produces:

   0 1 2 3 4

Iterates block, passing in integer values from int up to and including limit.

   5.upto(10) { |i| print i, " " }

produces:

   5 6 7 8 9 10

[Validate]