File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 88517f98743a5cbaaa818376eea77229da3c8453
4
+ refs/heads/snap-stage3: 1cf57f7b673ca94a32ec82c31b2bce79a5ca9394
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -1442,10 +1442,15 @@ call_closure_with_ten(closure);
1442
1442
~~~~
1443
1443
1444
1444
Closures begin with the argument list between vertical bars and are followed by
1445
- a single expression. The types of the arguments are generally omitted,
1446
- as is the return type, because the compiler can almost always infer
1447
- them. In the rare case where the compiler needs assistance, though, the
1448
- arguments and return types may be annotated.
1445
+ a single expression. Remember that a block, ` { <expr1>; <expr2>; ... } ` , is
1446
+ considered a single expression: it evaluates to the result of the last
1447
+ expression it contains if that expression is not followed by a semicolon,
1448
+ otherwise the block evaluates to ` () ` .
1449
+
1450
+ The types of the arguments are generally omitted, as is the return type,
1451
+ because the compiler can almost always infer them. In the rare case where the
1452
+ compiler needs assistance, though, the arguments and return types may be
1453
+ annotated.
1449
1454
1450
1455
~~~~
1451
1456
let square = |x: int| -> uint { x * x as uint };
You can’t perform that action at this time.
0 commit comments