1 |
schoenebeck |
2732 |
<html> |
2 |
|
|
<head> |
3 |
|
|
<meta name="author" content="Christian Schoenebeck"> |
4 |
|
|
<title>num_elements() function</title> |
5 |
|
|
<meta name="description" content="Returns the size of the requested array variable."> |
6 |
|
|
</head> |
7 |
|
|
<body> |
8 |
|
|
<h1>num_elements()</h1> |
9 |
|
|
<p> |
10 |
|
|
Returns the size of the requested array variable, that is the amount of |
11 |
|
|
total values that array variable contains. |
12 |
|
|
</p> |
13 |
|
|
|
14 |
|
|
<h3>Function Prototype</h3> |
15 |
|
|
<p/> |
16 |
schoenebeck |
2742 |
<code lang="nksp"> |
17 |
schoenebeck |
2732 |
num_elements(??array-variable??) |
18 |
|
|
</code> |
19 |
|
|
|
20 |
|
|
<h3>Arguments</h3> |
21 |
|
|
<table> |
22 |
|
|
<tr> |
23 |
|
|
<th>Argument Name</th> <th>Data Type</th> <th>Description</th> |
24 |
|
|
</tr> |
25 |
|
|
<tr> |
26 |
|
|
<td><code>??array-variable??</code></td> |
27 |
|
|
<td>Integer Array</td> |
28 |
|
|
<td>Array variable for which the size shall be obtained from.<br> |
29 |
|
|
[required]</td> |
30 |
|
|
</tr> |
31 |
|
|
</table> |
32 |
|
|
|
33 |
|
|
<h3>Return Value</h3> |
34 |
|
|
<table> |
35 |
|
|
<tr> |
36 |
|
|
<th>Description</th> <th>Data Type</th> |
37 |
|
|
</tr> |
38 |
|
|
<tr> |
39 |
|
|
<td>Size of the passed array variable.</td> |
40 |
|
|
<td>Integer Number</td> |
41 |
|
|
</tr> |
42 |
|
|
</table> |
43 |
|
|
|
44 |
|
|
<h3>Examples</h3> |
45 |
|
|
<p/> |
46 |
|
|
<code> |
47 |
|
|
on init |
48 |
|
|
declare const $SIZE := 5 |
49 |
|
|
declare %a[$SIZE] := ( 0,1,2,3,4 ) |
50 |
|
|
|
51 |
|
|
$i := 0 |
52 |
|
|
while ($i < num_elements(%a)) |
53 |
|
|
message("array[" & $i & "] = " & %a[$i]) |
54 |
|
|
$i := $i + 1 |
55 |
|
|
end while |
56 |
|
|
end on |
57 |
|
|
</code> |
58 |
|
|
|
59 |
|
|
</body> |
60 |
|
|
</html> |