http://qs1969.pair.com?node_id=1023532


in reply to Re^2: Is it safe to append to the array you are iterating over
in thread Is it safe to append to the array you are iterating over

The problem is that even if the logic in the loop body doesn't cause an infinite loop; you are at the very least also iterating over all the additional elements that you push for no good reason. You've just pushed those values; you presumably don't want them to cause further pushes.

Why do pointless extra work when it is so easily avoided?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
/div