push

Description

Pushes a new item to the end of an existing array.

push ( "array_name", "additional item" )

Example

{list_of_numbers = [1,2,3,4]}
{push("list_of_numbers", 5)}  ...... makes list_of_numbers = [1,2,3,4,5]

Note: this can also be accomplished in the following way:

{a = ['hey','hi']}
{a = a + ['hello']} ........ pushes 'hello' into a

Within a foreach loop or a map‘s lambda function, you cannot use push on the loop’s iterated array or map’s array parameter.

For example, the following code would result in an error:

{numbers = [1,2,3]}
{map(numbers, lambda n: push('numbers', n))}
Top