Item setter
Last updated
Last updated
[data/dictionary/Item setter]
Sets an item's value by its key in a dictionary. If the item is not found, it will be created. Example A:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via dict
"first"@0 received via key
-1@0 received via value
dict
sends { "first": -1, "third": 3, "fifth": 5 }@0
Example B:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via dict
"second"@0 received via key
2@0 received via value
dict
sends { "first": 1, "second":2, "third": 3, "fifth": 5 }@0
More: https://github.com/Cranq-io/cranq-tutorials/tree/main/reference/2_constructing_data/2_1_setters_deleters
Keywords: dictionary, dict, set, add, value
dict: {string: any}
Receives the dictionary to set the value in. Example: { "first": 1, "third": 3, "fifth": 5 }
key: string
Receives the key corresponding to the value to set. Example: "second"
value: {string: any}[string]
Receives the value to set. Example: 2
dict: {string: any}
Sends the resulting dictionary, with the new/altered item. Example: { "first": 1, "second":2, "third": 3, "fifth": 5 }