Am 02.02.2011 20:16, schrieb Andrej Mitrovic:
int[][][][] multiArray;

void main()
{
     foreach (one, two; multiArray)  // ok
     {
     }

     foreach (one, two, three; multiArray)  // fail
     {
     }
}

test.d(13): Error: cannot infer type for two
test.d(13): Error: cannot infer type for three

Same thing happens with hashes as well. Is this a limitation in the language or 
a bug?
I use the following idiom.

foreach(x, ref column; array)
foreach(y, ref element; column)
//maybe more...
{
    //do something
}

It works because of "constructs take one staement & one block is one statement". It is really great because it leads to such flexible soultions. You might say it's bad practise bad then you have to say the same about 'else if'.

Mafi

Reply via email to