dict create

Makes a dict from keys and values.

dict create ?KEY VALUE ...?

Description

Gives a new dict with each KEY and its VALUE, in the order of the arguments. A key that comes twice keeps its first place and its last value. With no argument it gives an empty dict. A key can be any string, also an empty one.

Arguments

ArgumentTypeDefaultDescription
KEYstringnoneA key.
VALUEany valuenoneThe value of the key before it.

Returns

The new dict.

Examples

% dict create a 1 b 2
a 1 b 2

% dict create a 1 b 2 a 3
a 3 b 2

% dict create

% dict create {} x
{} x

Errors

% dict create a
wrong # args: should be "dict create ?key value ...?"
-errorcode TCL WRONGARGS

Facts

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

See also