title: Loop two arrays at once
body: <p>I do have an array with orders, each with a date. Like: </p>
  
  <pre><code>[
  #&lt;Order id: 1, date: '2019-10-07'&gt;,
  #&lt;Order id: 2, date: '2019-10-08'&gt;,
  #&lt;Order id: 3, date: '2019-10-10'&gt;,
  #&lt;Order id: 4, date: '2019-10-10'&gt;,
  #&lt;Order id: 5, date: '2019-10-12'&gt;
  ]
  </code></pre>
  
  <p>I want to display it like this:</p>
  
  <pre><code>2019-10-05:
  2019-10-06:
  2019-10-07: id 1
  2019-10-08: id 2
  2019-10-09:
  2019-10-10: id 3, id 4
  2019-10-11:
  2019-10-12: id 5
  2019-10-13: 
  </code></pre>
  
  <p>What is the best way to do this?</p>
  
  <p>I can think of the following options: </p>
  
  <ol>
  <li><code>date_range.each do ...</code> and check if there are any corresponding orders on that date. </li>
  <li>First sort the array of orders, then do <code>orders.each do ...</code> and check if there are any dates skipped.</li>
  </ol>
  
  <p>Is there some 3rd way, that is walking through both arrays simultaneously? Like starting with the dates, when there is a corresponding order, start continue with the orders until there is a new date?</p>