Debian Codegraph @

src/test/01-Basic/147-foreach-auto.ck

raw
1 //-------------------------------------------------------
2 // desc: iterating over multi-dimensional arrays
3 // requires: chuck-1.5.0.8 or higher
4 //-------------------------------------------------------
5
6 // a multi dimensional array
7 int array[2][0];
8
9 // fill the two arrays
10 array[0] << 1 << 2;
11 array[1] << 3 << 4;
12
13 // loop over outer array
14 for( auto x[] : array )
15 {
16 // loop over inner array
17 for( int y : x )
18 {
19 <<< y >>>;
20 }
21 }