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

ArrayFirst

Last update:
May 18, 2026

Description

Gets the first element from an array.

Returns

The first array element.

Category

Syntax

ArrayFirst(array)

See also

History

ColdFusion (2018 release): Added the function.

Parameters

ParameterReq/OptDescription
Array
Required
The input array from which the first element is to be displayed.

Example

<cfscript>
 animals = ['cat','dog','fish','bison'];
 firstAnimal=ArrayFirst(animals);
 writeOutput("The first element of the array is: " & firstAnimal);
</cfscript>

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