ArrayLast

Return first item in array

Method Signature

ArrayLast(array=[array])

Arguments

Argument
Type
Required
Description
Default

array

array

true

The array to get the last

Examples

Show the last element of an array

Uses the arrayLast function to retrieve the last element of an array

Run Example

someArray = [ 
	"first",
	"second",
	"third"
];
lastOne = arrayLast( someArray );
writeOutput( lastOne );

Result: "third"

Additional Examples

Run Example

names = [ 
	"Marcus",
	"Sarah",
	"Josefine"
];
dump( names.last() );
 // outputs 'Josefine'
names = array( "Marcus", "Sarah", "Josefine" );
dump( arrayLast( names ) );
 // outputs 'Josefine'

Last updated

Was this helpful?