beetlebug▾
/

array exists

Tests if a variable is an array.

array exists ARRAYNAME

Description

Gives 1 when ARRAYNAME is an array variable, also an empty array, and 0 for a variable with a plain value or a name with no variable.

Arguments

ArgumentTypeDefaultDescription
ARRAYNAMEvariable namerequiredThe variable to test.

Returns

1 or 0.

Examples

% array set x {a 1}; array exists x
1

% array set empty {}; array exists empty
1

% set plain 5; array exists plain
0

% array exists nope
0

Errors

% array exists
wrong # args: should be "array exists arrayName"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also