Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
positively-charged committed Dec 9, 2016
1 parent c3cf1b6 commit 2b24e0b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doc/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,12 @@ _Calling a nested function recursively too many times will eventually crash the

<h4>Anonymous functions</h4>

<pre>
( function msgbuild { [<i>statements</i>] } )
( function { [<i>statements</i>] } )
( { [<i>statements</i>] } )
</pre>

You can declare and call a nested function at the same time. Only the body can be specified; the nested function will be implicitly defined as having no name, no parameters, and `auto` as the return type. Such a nested function is called an <em>anonymous function</em>. An anonymous function must be placed between parentheses:

```
Expand Down Expand Up @@ -891,12 +897,12 @@ void Welcome( int borderLength ) {
}
```

Anonymous functions can be used as message-building functions. The anonymous function is implicitly qualified with `msgbuild`:
Anonymous functions can be used as message-building functions:

```
void Welcome( int borderLength ) {
// Create and print message.
Print( msgbuild: {
Print( msgbuild: ( function msgbuild {
msgbuild void CreateBorder() {
int i = 0;
while ( i < borderLength ) {
Expand All @@ -908,7 +914,7 @@ void Welcome( int borderLength ) {
append( s: "\n" );
append( s: "Hello there!\n" );
CreateBorder();
} );
} ) );
}
```

Expand Down

0 comments on commit 2b24e0b

Please sign in to comment.