insert
Add entries to a dictionary.
📝Syntax
db = insert(da, key, value)
db = insert(da, key, value, 'Overwrite', tf)
📥Input Arguments
Parameter Description
da scalar: a dictionary object.
key scalar or array: key
value scalar or array: value. size of key must be compatible with the size of value.
tf true force to Overwrite, false do not overwrite and ignore change
📤Output Arguments
Parameter Description
db scalar: a dictionary object.
📄Description

db = insert(da, key, value) adds the key-value pair to the dictionary da.

If the key already exists, its value is updated.

d = insert(d, key, value) is equivalent to d[key] = value.

db = insert(da, key, value, 'overwrite', tf) specifies whether to overwrite an existing value for the key based on the boolean parameter Overwrite.

💡Examples
names = ["Apple" "Banana" "Kiwi"];
wheels = [1 2 3];
d = dictionary(wheels, names)
d = insert(d, [2 4] ,["Orange" "Citra"], 'Overwrite', false)
🔗See Also
dictionaryremovelookup
🕔Version History
Version Description
1.5.0 initial version
Edit this page on GitHub