beetlebug▾
/

tsv exists

Tests if an element of a shared array exists.

tsv::exists ARRAY ELEMENT

Description

The command tsv::exists gives 1 when the array ARRAY has the element ELEMENT, and 0 when it does not or when the array does not exist. It needs ELEMENT: for an array, test tsv::array size or tsv::names.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringrequiredThe name of the element.

Returns

1 or 0.

Examples

% tsv::set a x 1
> tsv::exists a x
1

% tsv::exists nope x
0

Errors

% tsv::exists a
wrong # args: should be "tsv::exists array key ?args?"
-errorcode TCL WRONGARGS

Facts

Capability
thread. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also