iffunc

Chooses between two values based on a third value.

Syntax

iffunc(expr1, expr2, expr3)

Argument

expr1
A scalar expression.
expr2
Any valid expression.
expr3
Any valid expression.

Example

Templex Expression Result
{iffunc(1, 2, 3) } 2
Curve Math Vectors Result
iffunc(0, 0:10:1, 0:10:2) 0, 2, 4, 6, 8, 10

Comments

Returns the value of expr2 if expr1 is non-zero, otherwise, returns the value of expr3.