This is an old version, view current version.

13.8 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;

Scheduled Removal: Stan 2.33