Whatever message this page gives is out now! Go check it out!

ArrayDeleteAt

Last update:
May 18, 2026

Description

Deletes an element from a specified position in an array. When an element is deleted, ColdFusion recalculates index positions. For example, in an array that contains the months of the year, deleting the element at position 5 removes the entry for May. After this, to delete the entry for June, you would delete the element at position 5 (not 6).

Returns

A boolean value indicating if the array element has been successfully deleted.

Category

Function syntax

ArrayDeleteAt(array, position)

See also

ArrayInsertAtFunctions for XML object management in  Modifying a ColdFusion XML object  in the Developing ColdFusion Applications

History

ColdFusion (2018 release): Returns boolean value.
ColdFusion MX:
  • Changed behavior: This function can be used on XML objects.
  • Changed thrown exceptions: This function can throw the InvalidArrayIndexException error.

Parameters

ParameterDescription
array
Name of an array.
position
Array position.

Throws

If this function attempts to delete an element at position 0, or specifies a value for position that is greater than the size of array, this function throws an InvalidArrayIndexException error.

Example

<cfscript>
    myArray=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
    deleted=ArrayDeleteAt(myArray,2)
    writeOutput(deleted)
</cfscript>

Output

YES

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page