title: When, if ever, to use the Ruby keyword "for"
body: <p>I personally like to iterate using the <code>for</code> keyword in Ruby since it reads very clean, from my eye. I generally assume that <code>for</code> may be an alias to <code>Enumerable#each</code>, but I do not know whether is is correct. In the most basic example:</p>
  
  <pre><code>for i in (1..10)
    puts i
  end
  </code></pre>
  
  <p>behaves the same as</p>
  
  <pre><code>(1..10).each do |i|
    puts i
  end
  </code></pre>
  
  <p>just without creating a new variable scope. Moreover, <a href="http://www.ruby-doc.org/core-2.1.3/doc/syntax/control_expressions_rdoc.html#label-for+Loop" rel="nofollow">ruby-doc</a> says </p>
  
  <blockquote>
    <p>The <code>for</code> loop is rarely used in modern ruby programs.</p>
  </blockquote>
  
  <p>which makes me feel there is a specific, technical reason against the usage. Does it matter that there's no new variable scope? In what way?</p>