Skip to content

Commit

Permalink
Rollup merge of rust-lang#22307 - steveklabnik:gh14849, r=huonw
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Feb 15, 2015
2 parents 4587f64 + 148d90b commit 6aaf535
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2742,9 +2742,19 @@ items can bring new names into scopes and declared items are in scope for only
the block itself.

A block will execute each statement sequentially, and then execute the
expression (if given). If the final expression is omitted, the type and return
value of the block are `()`, but if it is provided, the type and return value
of the block are that of the expression itself.
expression (if given). If the block ends in a statement, its value is `()`:

```
let x: () = { println!("Hello."); };
```

If it ends in an expression, its value and type are that of the expression:

```
let x: i32 = { println!("Hello."); 5 };
assert_eq!(5, x);
```

### Method-call expressions

Expand Down

0 comments on commit 6aaf535

Please sign in to comment.