How can I use Array#delete while iterating over the array?
I asked this question not long ago.
Deleting While Iterating in Ruby?
It's not working because Ruby exits the .each
loop when attempting to delete something. If you simply want to delete things from the array, delete_if
will work, but if you want more control, the solution I have in that thread works, though it's kind of ugly.