Interested in improving this site? Please check the To Do page.
math.max
Returns the greater of two values. Although listed as a math verb, compares anything (including strings) that can be compared with a greater than symbol.
Syntax
math.max (a, b)
Params
- a is any frontier value
- b is any frontier value
Returns
Compares the two values a and b, and returns the greater of the two.
Examples
math.max (3, 4)
» 4
math.max ("abc", "def")
» "def"
math.max (-3.2, -1.2)
» -1.2
Notes
Although this verb is in the math group, it can actually compare any two Frontier values.
Note that if you compare values of different types, Frontier’s coercion rules will take effect and the result may not be the same as the input. For example:
math.max (1.1, "0.1") » "1.1" // that's a string!