in reply to Re^4: self-feeding infinite loop
in thread self-feeding infinite loop

s/index/item being references by your index/

The point wasn't about indexes being numbers or not, it was that modifying an array while iterating over it is dangerous and can lead to cases where it isn't obvious what should be done. In addition useing for or foreach isn't using indexes in an obvious manner so that when using it we seldom think about it as just using an index and counting up to the end of the array. Instead we (me at least) perceive it as moving over the actual values so that if you add or remove values I have no clear idea of what that should do to a for except I certainly expect it to break.

Eric Hodges