title: "for" vs "each" in Ruby
body: <p>I just had a quick question regarding loops in Ruby. Is there a difference between these two ways of iterating through a collection?</p>
  
  <pre><code># way 1
  @collection.each do |item|
    # do whatever
  end
  
  # way 2
  for item in @collection
    # do whatever
  end
  </code></pre>
  
  <p>Just wondering if these are exactly the same or if maybe there's a subtle difference (possibly when <code>@collection</code> is nil).</p>