Skip to content

Commit 7c2cccc

Browse files
authored
Merge pull request #124 from stan-dev/bugfix/void-functions
Rephrase the void functions chapter
2 parents b615675 + fab532e commit 7c2cccc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/functions-reference/void_functions.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Void Functions
22

33
Stan does not technically support functions that do not return values.
4-
It does support two types of statements that look like functions, one
5-
for printing and one for rejecting outputs. Documentation on these
6-
functions is included here for completeness. The special keyword
7-
`void` is used for the return type of void functions, because they
8-
behave like variadic functions with void return type, even though they
9-
are special kinds of statements.
4+
It does support two types of statements, one printing and one for rejecting
5+
outputs.
106

117
Although `print` and `reject` appear to have the syntax of functions,
128
they are actually special kinds of statements with slightly different
@@ -16,6 +12,10 @@ are the the only constructs to accept string literals (e.g., `"hello
1612
world"`) as arguments. Third, they have no effect on the log density
1713
function and operate solely through side effects.
1814

15+
The special keyword `void` is used for their return type because they behave
16+
like variadic functions with void return type, even though they are special
17+
kinds of statements.
18+
1919
```{r results='asis', echo=FALSE}
2020
if (knitr::is_html_output()) {
2121
cat(' * <a href="print-statement.html">Print Statement</a>\n')
@@ -37,7 +37,7 @@ or the R console in RStan).
3737
`void` **`print`**`(T1 x1,..., TN xN)`<br>\newline
3838
Print the values denoted by the arguments x1 through xN on the output
3939
message stream. There are no spaces between items in the print, but a
40-
line feed (LF; Unicode U+000A; C++ literal `'\{n}'`) is inserted at
40+
line feed (LF; Unicode U+000A; C++ literal `'\n'`) is inserted at
4141
the end of the printed line. The types `T1` through `TN` can be any of
4242
Stan's built-in numerical types or double quoted strings of ASCII
4343
characters.
@@ -58,7 +58,7 @@ context in which it occurs).
5858
Reject the current iteration and print the values denoted by the
5959
arguments x1 through xN on the output message stream. There are no
6060
spaces between items in the print, but a line feed (LF; Unicode
61-
U+000A; C++ literal `'\{n}'`) is inserted at the end of the printed
61+
U+000A; C++ literal `'\n'`) is inserted at the end of the printed
6262
line. The types `T1` through `TN` can be any of Stan's built-in
6363
numerical types or double quoted strings of ASCII characters.
6464

0 commit comments

Comments
 (0)