Skip to main content

add (Function)

Function returns the updated list after adding the given value.

Syntax

<OBJECT> list:add(<OBJECT> list, <OBJECT|INT|LONG|FLOAT|DOUBLE|BOOL|STRING> value)
<OBJECT> list:add(<OBJECT> list, <OBJECT|INT|LONG|FLOAT|DOUBLE|BOOL|STRING> value, <INT> index)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
listThe list to which the value should be added.OBJECTNoYes
valueThe value to be added.OBJECT INT LONG FLOAT DOUBLE BOOL STRINGNoYes
indexThe index in which the value should to be added.lastINTYesYes

Example 1

list:add(stockSymbols, 'IBM')

Function returns the updated list after adding the value IBM in the last index.

Example 2

list:add(stockSymbols, 'IBM', 0)

Function returns the updated list after adding the value IBM in the 0th index`.