Skip to main content

array.pop()

Returns and removes the value at the end of the array

Availability

Device + Agent

Returns

Any Squirrel data type

Description

This method returns the value at end of the target array — the element with the highest index — and then removes it from the array. The returned value may be of any Squirrel data type.

Example Code

// Create an array to hold any timers we establish
local timers = [];
// Do work...
// Cancel all timers, the most recently added first
do {
imp.cancelwakeup(timers.pop());
} while (timers.len() > 0);