title: Remove nil values from array and corresponding entries from reference array
body: <p>I have two arrays generated from :</p>
  <pre><code>@dividends_values = @dividends.historical.map(&amp;:dividend).reverse.last(50)
  @dividends_dates = @dividends.historical.map(&amp;:date).reverse.last(50)
  </code></pre>
  <p>The first array is an array of float values and occasional there can be a few nil entries in that. I want to remove those nil entries(which is pretty easy with a compact or something like that), but I also want to move the corresponding entries from the @dividends_dates array.</p>
  <p>That is because they the dates array is a 1-1 reference to the values array, so index 0 of array with dates correspondings to index 0 of array with values.</p>
  <p>What is a good way to do that?</p>