arrayClear

Removes all elements from an array.

arrayClear(array) → returns boolean

Member Function Syntax

someArray.clear()

Argument Reference for the arrayClear function

array

Required: Yes
An array name or variable name

Examples sample code invoking the arrayClear function


Clear the value of an array

Uses the arrayClear function to clear the value of an array

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

Expected Result: Yes


Clear the value of an array

Lucee 4.5+ To clear the value of an array

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

Expected Result: true


Clear value of an array using member function

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