Debian Codegraph @

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

raw
1 // testing continue and break
2
3 // create empty array
4 int array[0];
5
6 // append
7 array << 1 << 2 << 3;
8
9 // for each element 'x' in array
10 for( int x : array )
11 {
12 // print the element
13 <<< x >>>;
14 // should be after last element printed
15 if( x == 3 ) continue;
16 }
17
18 // for each element 'x' in array
19 for( int x : array )
20 {
21 // print the element
22 <<< x >>>;
23 if( x == 2 ) break;
24 }