1 Void Functions
Stan does not technically support functions that do not return values. It does support two types of statements, one printing and one for rejecting outputs.
Although print
and reject
appear to have the syntax of functions,
they are actually special kinds of statements with slightly different
form and behavior than other functions. First, they are the
constructs that allow a variable number of arguments. Second, they
are the the only constructs to accept string literals (e.g., "hello world"
) as arguments. Third, they have no effect on the log density
function and operate solely through side effects.
The special keyword void
is used for their return type because they behave
like variadic functions with void return type, even though they are special
kinds of statements.