dict keys

Gives the keys of a dict, or the keys that match a glob pattern.

dict keys DICT ?PATTERN?

Description

Gives a list of the keys of DICT in their order. With PATTERN it gives only the keys that match it, with the rules of string match.

Arguments

ArgumentTypeDefaultDescription
DICTdictrequiredThe dict.
PATTERNglob patternnoneA pattern for the keys.

Returns

A list of keys.

Examples

% dict keys {a 1 b 2 ab 3}
a b ab

% dict keys {a 1 b 2 ab 3} a*
a ab

% dict keys {}

Errors

% dict keys {a 1 b}
missing value to go with key
-errorcode NONE

Facts

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

See also