Showing the changes to examples/array/array_mmixed.ck (1 of 486 files). Show all
Unified · Split
| @@ -0,0 +1,17 @@ | ||
| 1 | +// based on Robin Haberkorn's example | |
| 2 | +int a[0][2]; | |
| 3 | + | |
| 4 | +// instantiate arrays | |
| 5 | +new int[2] @=> a["foo"]; | |
| 6 | +new int[2] @=> a["bar"]; | |
| 7 | + | |
| 8 | +// fill them | |
| 9 | +23 => a["foo"][0]; | |
| 10 | +24 => a["foo"][1]; | |
| 11 | +32 => a["bar"][0]; | |
| 12 | +42 => a["bar"][1]; | |
| 13 | + | |
| 14 | +// test them | |
| 15 | +if( a["foo"][0] == 23 && a["bar"][1] == 42 ) | |
| 16 | + <<< "success" >>>; | |
| 17 | + | |