title: Why do you need to subtract from size of array?
body: <p>When I try to run the second line without subtracting from the size of the array, it won't work. Why not? </p>
  
  <pre><code>values = [10, 9, 11, 2, 45]
  max_element = values.size - 1
  first = values[0]
  for i in 0..max_element
    while first &lt; values[i]
      first = values[i]
    end
  end
  p "The largest value is #{first}"
  </code></pre>
  
  <p>Besides methods on <code>Enumerable</code> or <code>Array</code> such as <code>each</code>, is <code>for</code> the only iterator that loops over a collection of elements?</p>