Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Last Altered:
Function [other Function type actions]
Item [operators of similar scope]
Dictionary, Set & List operations [other Dictionary, Set & List operations operators]
Baseline
9.5.0
Dictionary.extend(keyStr, valueStr)
This adds the valueStr string to the value(s) of a keyStr.
If keyStr does not exist, that key is created with a value of valueStr.
If keyStr exists, valueStr is appended to keyStr's existing value(s).
Assume $MyDictionary has no 'pear' keyStr. Example:
$MyDictionary = $MyDictionary.extend("pear","fruit");
The keyStr 'pear' is added and now has valueStr 'fruit'. Next:
$MyDictionary = $MyDictionary.extend("pear","green");
The keyStr 'pear' now has a new valueStr 'green', but the overall value is now the list 'fruit;green'.
To set the new valueStr so it replaces all existing value(s) see Dictionary.add().
Dictionary.add(dictStr)
From v9.5.0, the Dictionary.extend() operator takes a single argument, a dictionary—using the new {} syntax of key:pair elements which will extend the current elements.
$MyDictionary = $MyDictionary.extend({pear:green});
Note that quotes are not needed around the keyStr and valueStr.