Changes

Jump to: navigation, search

Looping with for and the Ruby Looping Methods

115 bytes added, 19:29, 26 November 2007
The Ruby upto Method
Alternatively, we could achieve identical behavior using the ''upto'' method, passing the value to which we want the loop to run as an argument to the method:
 
<pre>
5.upto(10) do
puts "hello"
end
</pre>
 
If we so desired, we could shorten this to a single line of code:
<pre>

Navigation menu