beetlebug▾
/

array nextelement

Gives the name of the next element of a search.

array nextelement ARRAYNAME SEARCHID

Description

Gives the name of the next element of the search SEARCHID of array startsearch, in the order in which the elements were made. After the last element it gives an empty string, so a script tests array anymore first when an element can have an empty name.

Arguments

ArgumentTypeDefaultDescription
ARRAYNAMEvariable namerequiredThe array of the search.
SEARCHIDsearch idrequiredThe id of array startsearch.

Returns

An element name, or an empty string at the end.

Examples

% array set c {p 1 q 2}; set id [array startsearch c]; array nextelement c $id
p

% array nextelement c $id
q

% array nextelement c $id

Errors

% array nextelement c bad
illegal search identifier "bad"
-errorcode TCL LOOKUP ARRAYSEARCH

% array nextelement c s-9-c
couldn't find search "s-9-c"
-errorcode TCL LOOKUP ARRAYSEARCH

% array nextelement c
wrong # args: should be "array nextelement arrayName searchId"
-errorcode TCL WRONGARGS

Facts

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

See also