Changes

Jump to: navigation, search

Looping with for and the Ruby Looping Methods

3 bytes removed, 15:02, 31 March 2009
no edit summary
== The Ruby for Loop ==
The ''for'' loop is a classic looping construct that exists in numerous other programming and scripting languages. It allows a task to be repeated a specific number of times. Ruby differs in that it it is used in conjunction with ranges (see [[Ruby Ranges]] for more details). For example, we can repeat a task 8 times using the following ''for'' statement:
<pre>
</pre>
This causes the the inner loop to break each time i equal equals 2, thereby returning control to the outer loop which in turn calls the inner loop:
<pre>

Navigation menu