arrayPop

Removes the last element from an array. This will cause an exception on an empty array.

arrayPop(array) → returns any

Member Function Syntax

array.pop()

arrayPop Argument Reference

array array
Required

The array whose last element is removed.

Compatibility

ColdFusion:

Version 2021+ The full function was added in ACF 2021, but the member function appears to work in ACF 2018 (likely using Java).

Lucee:

Version 5+ Lucee allows a second, optional argument defaultValue of any type that allows you to enter a default value to return if the array is empty.

Links more information about arrayPop

Examples sample code invoking the arrayPop function

This is the full function version of arrayPop to remove the last value of an array.

arr=[1,2,42] ;
p=ArrayPop(array=arr);
WriteOutput(p);

Expected Result: 3

Using the member function. This version also works in ACF2018.

arr=[1,2,42] ;
p=arr.pop();
WriteOutput(p);

Expected Result: 3


Fork me on GitHub