access foreach index counter for Iterate n times

Adam D Ruppe destructionator at gmail.com
Sat May 21 17:33:24 UTC 2022


On Saturday, 21 May 2022 at 17:07:41 UTC, mw wrote:
> 1) can we also have a true "loop counter"?

That's what the `enumerate` thing does.

Or you can just

int counter;
for(whatever) {
     scope(exit) counter++;
}




More information about the Digitalmars-d mailing list