Get Item In List At Index | ARRAY_GET
Syntax
ARRAY_GET( [value], [index], [default = null] )
Parameters
value
The ARRAY the value is being pulled from.
index
The index in the ARRAY to pull the value from.
The first index is 0.
If a negative value is provided, it is indexed from the end.
For example, the index -1 can be used to get the last value in the ARRAY.
default optional
The default value if the index is out of the bounds of the ARRAY.
Return Value
The item at the the given INDEX within the VALUE is returned.Description
Gets a value in an array at a specified index.Examples
ARRAY_GET(["first", "second", "third"], 1) # returns "second"
ARRAY_GET(["first", "second", "third"], -2) # returns "second"
ARRAY_GET(["first", "second", "third"], 3) # returns NULL
ARRAY_GET(["first", "second", "third"], -4) # returns NULL
ARRAY_GET(["first", "second", "third"], 3, "DEFAULT") # returns "DEFAULT"
ARRAY_GET(["first", "second", "third"], 2, "DEFAULT") # returns "third"
ARRAY_GET([null], 0, "DEFAULT") # returns NULL