beetlebug▾
/

tsv unset

Removes elements of a shared array, or the whole array.

tsv::unset ARRAY ?ELEMENT ...?

Description

The command tsv::unset removes each ELEMENT of ARRAY. With no ELEMENT, it removes the array. An element or an array that does not exist is an error.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringnoneAn element to remove.

Returns

An empty string.

Examples

% tsv::set b k 1
> tsv::set b j 2
> tsv::unset b k
> tsv::array names b
j

% tsv::set b k 1
> tsv::unset b
> tsv::names b

Errors

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

% tsv::unset nope
"nope" is not a thread shared array
-errorcode NONE

% tsv::set a x 1
> tsv::unset a nope
no key a(nope)
-errorcode NONE

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