From: Sherm Pendley on
"A. Farber" <alexander.farber(a)gmail.com> writes:

> From searching I know, that this is because
> I'm removing an element of an array
> whil iterating over it.
>
> But my question is, how could I workaround it?

Instead of removing elements immediately, push them
onto another array. Once you're done iterating over
the "main" array, iterate over the "hit list" array
and remove the elements in it from the "main" array.

sherm--
From: A. Farber on
On Feb 28, 7:59 pm, Sherm Pendley <sh...(a)debian.shermpendley.com>
wrote:
> "A. Farber" <alexander.far...(a)gmail.com> writes:
> > From searching I know, that this is because
> > I'm removing an element of an array
> > whil iterating over it.
>
> Instead of removing elements immediately, push them
> onto another array. Once you're done iterating over
> the "main" array, iterate over the "hit list" array
> and remove the elements in it from the "main" array.

Good idea, thank you!