ifelse(bool c, var x, var y): var

Returns x when the expression or comparison c is true or nonzero, otherwise y.

Parameters:

c - any boolean expression.
x,y - any var.

Returns:

x when c is true, otherwise y.

Example:

var a = ifelse(x > y,x,y); // a is now the maximum of x and y

See also:

abs, min, max, between, sign, clamp, if

► latest version online