arrayClear

Removes all elements from an array.

arrayClear(array) → returns boolean

Member Function Syntax

someArray.clear()

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

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub