ARRAY_MAX
Description
The array_max
function is used to find the maximum value from the input array. This function will automatically ignore null values in the array.
Syntax
Parameters
array
:array<T>
, represents the input array, where T is the data type of the array elements.
Return Value
- The return type is automatically inferred based on the element type of the input array, i.e.,
T <- array<T>
.
Usage Example
- Find the maximum value in an integer array:
Results:
- Find the maximum value in an array of floating-point numbers:
Results:
- Find the maximum value in a string array (lexicographically):
Results:
- Handling Arrays with Null Values:
Results:
Precautions
- When the input array is empty, the
array_max
function will return null. - If all elements in the array are null, the function will also return null.
With the above examples and explanations, you can use the array_max
function more effectively to handle the maximum value problem in arrays.