Typo Fixed evironment to environment

This commit is contained in:
Mujeebullah Kalwar
2023-07-20 02:44:15 +05:00
parent f8ebc89a66
commit de7e0d25dd

View File

@ -245,7 +245,7 @@ fn main() {
10. 10.
```rust ```rust
/* Fill in the blank and fix the errror */ /* Fill in the blank and fix the error */
// You can also use `impl FnOnce(i32) -> i32` // You can also use `impl FnOnce(i32) -> i32`
fn create_fn() -> impl Fn(i32) -> i32 { fn create_fn() -> impl Fn(i32) -> i32 {
let num = 5; let num = 5;
@ -261,11 +261,11 @@ fn main() {
``` ```
```rust ```rust
/* Fill in the blank and fix the errror */ /* Fill in the blank and fix the error */
fn create_fn() -> Box<dyn Fn(i32) -> i32> { fn create_fn() -> Box<dyn Fn(i32) -> i32> {
let num = 5; let num = 5;
// how does the following closure capture the evironment variable `num` // how does the following closure capture the environment variable `num`
// &T, &mut T, T ? // &T, &mut T, T ?
Box::new(move |x| x + num) Box::new(move |x| x + num)
} }