src/test/01-Basic/146-foreach-auto.ck
raw| 1 | //------------------------------------------------------- |
| 2 | // desc: using for-each construct with auto type |
| 3 | // requires: chuck-1.5.0.8 or higher |
| 4 | //------------------------------------------------------- |
| 5 | |
| 6 | // create array |
| 7 | [1,2,3] @=> int array[]; |
| 8 | |
| 9 | // for each element 'x' in array |
| 10 | for( auto x : array ) |
| 11 | { |
| 12 | // print the element |
| 13 | <<< x >>>; |
| 14 | } |