[best practices] Safely Destroy entries while iterating over them?

Just happened upon this in the docs:
Also note that you should never iterate through arrays and destroy the elements you are iterating over. This will cause serious problems (as a general programming practice, not just in Unity).

I do this all the time with inverted loops and never have any issues, so I wondered, what is the truth behind this cautionary statement? Is this actually a dangerous thing to do for some reason I’ve yet to encounter? Big thanks,

for (int = collection.Count-1; i>=0; i--) Destroy( collection *);*

edit to include docs link: Unity - Scripting API: Object.DestroyImmediate

It’s only dangerous if you do it wrong, which is very easy to do.

DestroyImmediate is meant for use in the Editor. Destroy uses garbage collection which is why you don’t have problems destroying things while iterating over them (they still live for a frame or two).