array statistics
Gives a line of text with the count of elements of an array.
array statistics ARRAYNAME
Description
Gives the text N entries in table, with N the count of elements. A script reads the count with array size.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| ARRAYNAME | variable name | required | The array. |
Returns
A line of text.
Examples
% array set st {a 1 b 2 c 3}; array statistics st
3 entries in table
% array set none {}; array statistics none
0 entries in table
Errors
% array statistics nope
"nope" isn't an array
-errorcode TCL LOOKUP ARRAY nope
% array statistics
wrong # args: should be "array statistics arrayName"
-errorcode TCL WRONGARGS
Differences from Tcl
- Tcl also gives the counts of the buckets of its hash table.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1