Iterate over an array while mutating it?

Anh Nhan anhnhan at outlook.com
Thu Mar 27 15:23:40 PDT 2014


Hey guys,

I want to iterate over an array, while adding new entries, and 
have those in the iteration loop.

See here: https://gist.github.com/AnhNhan/9820226

The problem is that the foreach loop seemingly only iterates over 
the original array, not minding the newly added entries.

Does somebody have a solution or approach for the loop to pick up 
those new entries?

Anh Nhan


More information about the Digitalmars-d-learn mailing list