Max

Returns the largest value from one or more numbers.

Category: Math Returns: matches the input type; see overloads.

Signature

Max(value, ...)

Pass one or more values. The runtime picks the overload based on the argument types. Mixing types (e.g. int with decimal) routes through the number overload.

Overloads

ArgsReturnsNotes
(int, ...)intAll-integer; result is integer.
(decimal, ...)decimalAll-decimal; result is decimal.
(number, ...)numberFallback when types can’t be statically resolved (e.g. variable inputs).

Examples

Max(a, b)                       // two-value maximum
Max(damage - armor, 0)          // floor negative damage at zero
Max(strength, agility, wisdom)  // pick the dominant stat

Notes

Use Max(a, b) for a simple two-argument maximum. For more arguments, pass them all in a single call: Max(a, b, c, d). A single argument is also valid and returns that value unchanged; calling Max with no arguments at all is an error. The companion function Min returns the smallest value.

Docs last synced: 2026-07-08
Screenshot viewer