Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/expressions/closure-expr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Closure expressions

> **<sup>Syntax</sup>**
> _ClosureExpression_ :
> &nbsp;&nbsp; `move`<sup>?</sup>
> &nbsp;&nbsp; ( `||` | `|` [_FunctionParameters_]<sup>?</sup> `|` )
> &nbsp;&nbsp; ([_Expression_] | `->` [_TypeNoBounds_]&nbsp;[_BlockExpression_])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is TypeNoBounds actually defined anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


A _closure expression_ defines a closure and denotes it as a value, in a single
expression. A closure expression is a pipe-symbol-delimited (`|`) list of
patterns followed by an expression. Type annotations may optionally be added
Expand Down Expand Up @@ -56,3 +62,8 @@ ten_times(move |j| println!("{}, {}", word, j));

[block]: expressions/block-expr.html
[function definitions]: items/functions.html

[_Expression_]: expressions.html
[_BlockExpression_]: expressions/block-expr.html
[_TypeNoBounds_]: types.html
[_FunctionParameters_]: items/functions.html