mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 23:38:41 +08:00
Updating text wrapping
This commit is contained in:
parent
72dec3166b
commit
937d932a07
@ -5,9 +5,9 @@
|
|||||||
### What is a closure
|
### What is a closure
|
||||||
|
|
||||||
In programming languages, a closure is a lot like a function. Like a function, closures contain code
|
In programming languages, a closure is a lot like a function. Like a function, closures contain code
|
||||||
that is executed when the closure is called. The main difference, besides syntax, between closures and functions is
|
that is executed when the closure is called. The main difference, besides syntax, between closures
|
||||||
that closures have *capture*. What this means is that a closure can use variables in its surrounding
|
and functions is that closures have *capture*. What this means is that a closure can use variables
|
||||||
scope. Consider the following code:
|
in its surrounding scope. Consider the following code:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user