arrayClear

Removes all elements from an array.

arrayClear(array) → returns boolean

Member Function Syntax

someArray.clear()

arrayClear Argument Reference

array array
Required

An array name or variable name

Examples sample code invoking the arrayClear function

Uses the arrayClear function to clear the value of an array

someArray = ["Red", "White", "Green", "Blue", "Pink"];
writeOutput(arrayClear(someArray));

Expected Result: Yes

Lucee 4.5+ To clear the value of an array

someArray = ["Red", "White", "Green", "Blue", "Pink"];
writeOutput(arrayClear(someArray));

Expected Result: true

CF 11+ Uses the member function is the same as running arrayClear.

numberArray = [1,2,3];
writeOutput(numberArray.Clear());

Expected Result: Yes


Fork me on GitHub