SplitScript reference / Numeric / max

Numeric.max

Method

T.max(other: T) -> T where T: Numeric

Returns the larger of two numeric values.

Both values have the same inferred numeric type and are evaluated once. For floating-point values, either NaN input produces NaN. If the values are positive and negative zero, positive zero is returned.

Parameters

  • other: The other value to compare with the receiver.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Keep the larger value

let nonNegativeScore = (-4).max(0)