What is the correct way of making this output `0 1 2`?

```d
void delegate()[] dgs;

foreach (immutable i; 0..3)
{
    dgs ~= () => writeln(i);
}

foreach (dg; dgs)
{
    dg();  // outputs: `2 2 2`
}
```

Reply via email to