Name
keylget
- keylget
listvar
[key
] [retvar
|{}] Return the value associated with
key
from the keyed list in variablelistvar
. Ifretvar
is not specified, the value will be returned as the result of the command. In this case, ifkey
is not found in the list, an error will result.If
retvar
is specified andkey
is in the list, the value is returned in the variableretvar
and the command returns 1 if the key was present within the list. Ifkey
is not in the list, the command will return 0, andretvar
will be left unchanged. If {} is specified forretvar
, the value is not returned, allowing the programmer to determine if a key is present in a keyed list without setting a variable as a side effect.If
key
is omitted, a list of all the keys in the keyed list is returned.
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.