Interested in improving this site? Please check the To Do page.

Back to Math Verbs

math.min

Returns the lesser of two values. Although listed as a math verb, compares anything (including strings) that can be compared with a less than symbol.

Syntax

math.min (a, b)

Params

  • a is any frontier value
  • b is any frontier value

Returns

The lesser of the two values

Examples

math.min (3, 4)
   » 3

math.min ("abc", "def")
   » "abc"

math.min (-3.2, -1.2)
   » -3.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.min( 1.1, "0.1" )
   » "0.1"

(This has been fixed in the source, and should not be an issue in the next developer preview release.)

Reference

See Also


Personal Tools