Skip to main content

array.push(item)

Adds an item to the end of an array

Availability

Device + Agent

Parameters

Name Type Description
item Any Any Squirrel data type

Returns

Nothing

Description

This method adds the value passed as the method’s parameter to the end of the target array, increasing the array’s size by one item.

The pushed value can be of any Squirrel data type. However, if functions and/or objects are inserted into the array, the array can no longer be serialized (see the Developer Guide ‘Serializable Squirrel’).

In operation, push() is identical to append() but provides a more convenient method name for those programmers particularly accustomed to working with stacks.

Example Code