method
Math.max
Math.max(a, b) -> int
Returns whichever of a and b is larger. Like Math.min, it works for both int and fixed operands. Use it to hold a value at a floor — for example keeping a countdown at zero instead of going negative, or a health bar from dropping below the minimum. The bare form max(a, b) is kept as a convenience alias.
Parameters
athe first valuebthe second valueExample
program Countdown {
var timer: int = 60
handler Tick phase Update {
timer = Math.max(timer - 1, 0) # stops at 0, never negative
}
}