arrayMax

Returns the largest numeric value in an array. If the array
parameter value is an empty array, returns zero.
All elements must contain values that can be automatically
converted to numeric values.

arrayMax(array) → returns Numeric

Member Function Syntax

someArray.max()

arrayMax Argument Reference

array
Required

An array or variable name

Examples sample code invoking the arrayMax function


Simple example with empty array

To get the largest numeric value of an array

someArray = arrayNew(1);
writeOutput(arrayMax(someArray));

Expected Result: 0


Get largest numeric value of an array

Uses the arrayMax function to get the largest numeric value of an array

someArray = [23,45,87,1,4];
writeOutput(arrayMax(someArray));

Expected Result: 87


Get largest numeric value of an array using member function

CF 11+ Lucee 4.5+

someArray = [23,45,0,1,4];
writeOutput(someArray.max());

Expected Result: 45


Fork me on GitHub