As int is already an Integer, all these methods simply return the receiver.
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!
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
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
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.