I have two foreach loops where the inner should change the iterator (append new entries) of the outer.

foreach(a, candidates) {
        foreach(b, a) {
                if(...) candidates ~= additionalCandidate;
        }
}

The foreach docs state that the collection must not change during iteration.

So, how to best handle such a situation then? Using a plain for loop?

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to