title: What is "for" in Ruby
body: <p>In Ruby:</p>
  
  <pre><code>for i in A do
      # some code
  end
  </code></pre>
  
  <p>is the same as: </p>
  
  <pre><code>A.each do |i|
     # some code
  end
  </code></pre>
  
  <p><code>for</code> is not a kernel method:</p>
  
  <ul>
  <li>What exactly is "<code>for</code>" in ruby</li>
  <li>Is there a way to use other keywords to do similar things? </li>
  </ul>
  
  <p>Something like:</p>
  
  <pre><code> total = sum i in I {x[i]}
  </code></pre>
  
  <p>mapping to:</p>
  
  <pre><code> total = I.sum {|i] x[i]}
  </code></pre>