ITP - loops & iterators - x = array

The odd thing about the for loop is that the loop returns the collection
of elements after it executes, whereas the earlier while loop examples
return nil. Let's look at another example using an array instead of a
range.

x = [1, 2, 3, 4, 5]

for i in x do
  puts i
end

puts "Done!"

You can see there are a lot of ways to loop through collection of
elements using Ruby. Let's talk about some more interesting ways you can
use conditions to modify the behavior of your loops. Most Rubyists
forsake for loops and prefer using iterators instead. We'll cover
iterators later.