struct.insert()
Inserts a key-value pair into a structure.
struct.insert( key=string, value=any, allowOverwrite=boolean )
Returns: Struct
| Argument | Description |
|---|---|
|
key
string,
required
|
edit
Key that contains the inserted value. |
|
value
any,
required
|
edit
Value to add. |
|
allowOverwrite
boolean,
optional
|
edit
Whether to allow overwriting a key. Default: False. Alias: overwrite |
Examples
editanimals = {
cow: "moo",
pig: "oink"
};
// Show current animals
Dump(
label: "Current animals",
var: animals
);
// Insert cat into animals
animals.insert("cat", "meow");
// Show animals, now includes cat
Dump(
label: "Animals with cat added",
var: animals
);