http://d.puremagic.com/issues/show_bug.cgi?id=6652
bearophile_h...@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_h...@eml.cc --- Comment #1 from bearophile_h...@eml.cc 2011-09-12 12:24:41 PDT --- Recently I have started a very long thread about this problem: http://www.digitalmars.com/d/archives/digitalmars/D/About_foreach_loops_138630.html http://www.digitalmars.com/d/archives/digitalmars/D/Re_About_foreach_loops_138666.html An alternative and probably a bit better solution is to think of 0..10 as a immutable entity (just like the integer number "1" is immutable, likewise a range of numbers is immutable), so the foreach index is a const (the compiler keeps only one index, for efficiency, and modifies this const index): foreach (int i; 0 .. 10) { i++; // forbidden, i is const } If you want to modify the index variable inside the loop, then you use a for() loop. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------