dict getwithdefaultTcl 9.1 only

Gives the value at a path of keys, or a default: the same command as dict getdef.

dict getwithdefault DICT ?KEY ...? KEY DEFAULT

Description

The same command as dict getdef, with a longer name. It is in Tcl 9.1 only.

Arguments

ArgumentTypeDefaultDescription
DICTdictrequiredThe dict.
KEYstringrequiredThe keys of the path, at least one.
DEFAULTany valuerequiredThe result when a key is missing.

Returns

The value, or DEFAULT.

Examples

% dict getwithdefault {a 1} b 9
9

Errors

% dict getwithdefault {a 1}
wrong # args: should be "dict getwithdefault dictionary ?key ...? key default"
-errorcode NONE

Facts

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

See also