Removes the last element from an array and returns the removed element. This will cause an exception on an empty array.
arrayPop(array)
→ returns any
array.pop()
defaultValue
of any
type that allows you to enter a default value to return if the array is empty.
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: 42
Using the member function. This version also works in ACF2018.
arr=[1,2,42];
p=arr.pop();
writeOutput(p);
Expected Result: 42
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.