On Mon, Jun 25, 2018 at 05:29:23PM +0200, Robert M. Münch via 
Digitalmars-d-learn wrote:
> 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?
[...]

Yes.


T

-- 
The fact that anyone still uses AOL shows that even the presence of options 
doesn't stop some people from picking the pessimal one. - Mike Ellis

Reply via email to