foreach
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 12 08:46:03 PDT 2014
On Thursday, 12 June 2014 at 15:09:51 UTC, simendsjo wrote:
>
> _ is an often used identifier for "i don't care" in many
> languages. The
> following works:
> foreach(_; 0..n)
One issue is that "_" is still an actual identifier, with normal
name collision rules. So that works only once. When you nest your
loops, you'll end up having conflicts, and name your "i don't
care variable" things such as "_", "__", "___", "_1", "_2" etc...
It actually happens quite often I find.
More information about the Digitalmars-d
mailing list