List.Max

Syntax

List.Max(list as list, optional default as any, optional comparisonCriteria as any, optional includeNulls as nullable logical) as any

About

Returns the maximum item in the list list, or the optional default value default if the list is empty. An optional comparisonCriteria value, comparisonCriteria, may be specified to determine how to compare the items in the list. If this parameter is null, the default comparer is used.

Example 1

Find the max in the list {1, 4, 7, 3, -2, 5}.

Usage

List.Max({1, 4, 7, 3, -2, 5}, 1)

Output

7

Example 2

Find the max in the list {} or return -1 if it is empty.

Usage

List.Max({}, -1)

Output

-1