title: What's the 'Ruby way' to iterate over two arrays at once
body: <p>More of a syntax curiosity than a problem to solve...</p>
  
  <p>I have two arrays of equal length, and want to iterate over them both at once - for example, to output both their values at a certain index.</p>
  
  <pre><code>@budget = [ 100, 150, 25, 105 ]
  @actual = [ 120, 100, 50, 100 ]
  </code></pre>
  
  <p>I know that I can use <code>each_index</code> and index into the arrays like so:</p>
  
  <pre><code>@budget.each_index do |i|
    puts @budget[i]
    puts @actual[i]
  end
  </code></pre>
  
  <p>Is there a <em>Ruby way</em> to do this better? Something <em>like</em> this?</p>
  
  <pre><code># Obviously doesn't achieve what I want it to - but is there something like this?
  [@budget, @actual].each do |budget, actual|
    puts budget
    puts actual
  end
  </code></pre>