Parent Directory | Revision Log
* Implemented built-in instrument script function "abs()". * Implemented built-in instrument script function "random()". * Implemented built-in instrument script function "num_elements()". * Disabled debug mode of RefPtr template class. * Bumped version (1.0.0.svn51).
1 | { Array variables are always global variables, with constant size defined at |
2 | parse time. Trying to declare an array size with a runtime expression (i.e. a |
3 | non const variable), will cause a parser error. } |
4 | |
5 | on init |
6 | declare const $SIZE := 5 |
7 | declare %a[$SIZE] := ( 0,1,2,3,4 ) |
8 | declare $i |
9 | |
10 | message("num_elements(%a) = " & num_elements(%a)) |
11 | |
12 | message("Initial values of array:") |
13 | |
14 | $i := 0 |
15 | while ($i < $SIZE) |
16 | message("array[" & $i & "] = " & %a[$i]) |
17 | $i := $i + 1 |
18 | end while |
19 | |
20 | %a[0] := 2 |
21 | %a[1] := 3 |
22 | %a[2] := 5 |
23 | %a[3] := 7 |
24 | %a[4] := 11 |
25 | |
26 | message("") |
27 | message("New values of array:") |
28 | |
29 | $i := 0 |
30 | while ($i < $SIZE) |
31 | message("array[" & $i & "] = " & %a[$i]) |
32 | $i := $i + 1 |
33 | end while |
34 | |
35 | end on |
ViewVC Help | |
Powered by ViewVC |