> For the complete documentation index, see [llms.txt](https://nelson-9.gitbook.io/nelson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nelson-9.gitbook.io/nelson/markdown/en/dictionary/insert.md).

# insert

Add entries to a dictionary.

## 📝 Syntax

* db = insert(da, key, value)
* db = insert(da, key, value, 'Overwrite', tf)

## 📥 Input argument

* 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 argument

* db - scalar: a dictionary object.

## 📄 Description

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

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.

## 💡 Example

```matlab
names = ["Apple" "Banana" "Kiwi"];
wheels = [1 2 3];
d = dictionary(wheels, names)
d = insert(d, [2 4] ,["Orange" "Citra"], 'Overwrite', false)
```

## 🔗 See also

[dictionary](/nelson/markdown/en/dictionary/dictionary.md), [remove](/nelson/markdown/en/dictionary/remove.md), [lookup](/nelson/markdown/en/dictionary/lookup.md).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.5.0   | initial version |
