Ruby For Loop

Watch out! This tutorial is over 3 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

The Ruby for loop is similar to the Python for or the perl foreach. Its basic operation is iterate over the contents of some collection. This may be an actual array or a range expression. A range expression is two numbers, surrounded by parens, and separated by either two dots or three. The three-dot form omits the last number from the range, while the two-dot version includes it. The three-dots version can be quite useful for creating a range of legal subscripts since the array size is not a legal subscript.