This is an old version, view current version.

13.10 if_else Function

Deprecated:The function if_else is deprecated. This function takes three arguments a, b, and c, where a is an int value and b and c are scalars. It returns b if a is non-zero and c otherwise.

Replacement: Use the conditional operator which allows more flexibility in the types of b and c and is much more efficient in that it only evaluates whichever of b or c is returned.

x = if_else(a,b,c);

with

x = a ? b : c;