| Class | Integer |
| In: |
numeric.c
lib/mathn.rb lib/yaml/rubytypes.rb |
As int is already an Integer, all these methods simply return the receiver.
Returns a string containing the character represented by the receiver‘s value according to encoding.
65.chr #=> "A" 230.chr #=> "\346" 255.chr(Encoding::UTF_8) #=> "\303\277"
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!
As int is already an Integer, all these methods simply return the receiver.
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
As int is already an Integer, all these methods simply return the receiver.
As int is already an Integer, all these methods simply return the receiver.
As int is already an Integer, all these methods simply return the receiver.
ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.