This is an old version, view current version.

31.7 Conditionals

Stan supports the full C++-style conditional syntax, allowing real or integer values to act as conditions, as follows.

real x;
...
if (x) {
   // executes if x not equal to 0
   ...
}

Explicit comparisons of non-Boolean conditions

The preferred form is to write the condition out explicitly for integer or real values that are not produced as the result of a comparison or boolean operation, as follows.

if (x != 0) ...