Tinderbox v9 Icon

Dictionary.extend(key, value)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Dictionary, Set & List operations   [other Dictionary, Set & List operations operators]

 9.1.0

 


Dictionary.extend(key, value)

This adds value to the value(s) of a key.

If key does not exist, that key is created with a value of value.

If key exists, value is appended to key's existing value(s).

Assume $MyDictionary has no 'pear' key. Example:

$MyDictionary = $MyDictionary.add("pear","fruit"); 

The key 'pear' is added and now has value 'fruit'. Next:

$MyDictionary = $MyDictionary.add("pear","green"); 

The key 'pear' now has a new value 'green', but overall value is now the list 'fruit;green'.

To set the new value so it replaces all existing value(s) see Dictionary.add().