提交 6c907212 编写于 作者: S Steve Klabnik

Add note about temporaries

上级 dc3a39d8
......@@ -196,8 +196,16 @@ let (x, _) = tuple;
println!("Tuple is: {:?}", tuple);
```
In a similar fashion to `_`, you can use `..` in a pattern to disregard
multiple values:
This also means that any temporary variables will be dropped at the end of the
statement:
```rust
// Here, the String created will be dropped immediately, as it’s not bound:
let _ = String::from(" hello ").trim();
```
You can also use `..` in a pattern to disregard multiple values:
```rust
enum OptionalTuple {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册