method
Math.min
Math.min(a, b) -> int
Returns whichever of a and b is smaller. It works on plain int values and on fixed values alike — both are stored as signed 32-bit words, so the comparison keeps their order either way. Use it to cap a value at a ceiling, keep a cursor inside a list, or take the nearer of two distances. The bare form min(a, b) is kept as a convenience alias.
Parameters
athe first valuebthe second valueExample
program ClampScore {
var score: int = 0
handler AddPoint phase Update {
score = Math.min(score + 1, 100) # never climbs past 100
}
}