How do I safely remove items from an array in a for loop? : <p>Full disclose, this is for a homework question:</p>

<blockquote>
  <p>It should have a private property of type [Circle]. An array of circles.
  The method should remove any circles that have a radius larger than
  the minimum requirement, and smaller than the max requirement.</p>
</blockquote>

<p>It seems obvious that I should use <code>removeAtIndex()</code> to remove array items that don't meet a condition determined in the loop. However, many have pointed out before the perils of removing items in a loop because of what I guess is a "iterator/index mismatch".</p>

<p>Ultimately I ended up creating an empty array and using <code>.append()</code> to push the values that meet the "good" condition to a <code>filteredCircles</code> array, but I can't help but to feel that this this doesn't meet the criteria for the assignment.</p>

<p>Is there a solution that actually removes the items from the array in a loop?</p>
