ArrayFirst

Description

Gets the first element from an array.

Returns

The first array element.

Category

Syntax

ArrayFirst(array)
ArrayFirst(array)
ArrayFirst(array)

See also

History

ColdFusion (2018 release): Added the function.

Parameters

Parameter

Req/Opt

Description

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

Ottieni supporto in modo più facile e veloce

Nuovo utente?