All But Last Item in List | ARRAY_INIT

Syntax

ARRAY_INIT( [value] )

Parameters

value
The ARRAY whose last item is being removed.

Return Value

The ARRAY with the item at index -1 removed.

Description

Removes the last item from an ARRAY. Returns a new ARRAY with the last item removed and does not modify the original ARRAY. If VALUE is not an ARRAY, it will be coerced to one with the ARRAY method.

Examples

ARRAY_INIT([1, 2, 3]) # returns [1, 2]
ARRAY_INIT([]) # returns []
ARRAY_INIT(null) # returns []