ArrayFirst
Return first item in array
Method Signature
ArrayFirst(array=[array], defaultValue=[any])Arguments
Argument
Type
Required
Description
Default
array
array
true
The array to get the first item from.
defaultValue
any
false
The value to return when the array is empty. If omitted, an exception is thrown for an empty array.
Examples
Member Function
Use the member function to return the first item from an array
someArray = [
1,
2,
3,
4
];
WriteOutput( someArray.first() );
Result: 1
Non-Member Function
Return the first item from an array
Result: "Jerry"
Additional Examples
Related
Last updated
Was this helpful?
