23.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) ...