Enhancing foreach

Ali Çehreli acehreli at yahoo.com
Wed Jan 9 10:26:02 PST 2013


On 01/09/2013 10:08 AM, ixid wrote:

 >> for (i; ++j) {
 >> /* ... */
 >> }
 >>
 >> Did I forget something or is it "from zero to the incremented value of
 >> j"?
 >

 > If this was supposed to be a normal for loop
 > the user's forgotten to give i a type and a boundary condition and the
 > second semi-colon, that's three errors, the space of different
 > behaviours you can get to in any given piece of code by making three
 > errors is probably quite high.

I think the name 'i' would make one think that there has been three 
mistakes. (I admit that I chose it that way. ;) ) In fact, there was a 
single mistake: a forgotten semicolon (and a space that comes with it 
for readability):

     for (; i; ++j) {
         /* ... */
     }

Ali



More information about the Digitalmars-d-learn mailing list