ArrayClear

Description

Deletes the data in an array.

Returns

True, on successful completion.

Function syntax

ArrayClear(array)

See also

ArrayDeleteAt; Functions for XML object management in the Developing ColdFusion Applications

History

ColdFusion MX: Changed behavior: This function can be used on XML objects.

Parameters

Parameter

Description

array

Name of an array

Example

<h3>ArrayClear Example</h3> 
<!--- Create a new array. ---> 
<cfset MyArray = ArrayNew(1)> 
<!--- Populate an element or two. ---> 
<cfset MyArray[1] = "Test"> 
<cfset MyArray[2] = "Other Test"> 
<!--- Output the contents of the array. ---> 
<p>Your array contents are: 
<cfoutput>#ArrayToList(MyArray)#</cfoutput> 
<!--- Check to see if the array is empty. ---> 
<p>Is the array empty?: 
<cfoutput>#ArrayIsEmpty(MyArray)#</cfoutput> 
<p>Now, clear the array: 
<!--- Now clear the array. ---> 
<cfset Temp = ArrayClear(MyArray)> 
<!--- Check to see if the array is empty. ---> 
<p>Is the array empty?: 
<cfoutput>#ArrayIsEmpty(MyArray)#</cfoutput>