Debian Codegraph @

src/test/01-Basic/138-foreach.ck

raw
1 //-------------------------------------------------------
2 // name: foreach-1.ck
3 // desc: using for-each construct to loop over array
4 //
5 // requires: chuck-1.5.0.8 or higher
6 //-------------------------------------------------------
7
8 // create empty array
9 float array[0];
10
11 // append
12 array << 1 << 2.5 << 3;
13
14 // for each element 'x' in array
15 for( float x : array )
16 {
17 // print the element
18 <<< x >>>;
19 }