1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-24 20:14:23 +01:00

Merge pull request #176 from larsks/fix/grammar

A minor grammar correction
This commit is contained in:
Satwik Kansal 2020-01-20 14:17:48 +05:30 committed by GitHub
commit e74ccb79d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
README.md vendored
View File

@ -1023,7 +1023,7 @@ Even when the values of `x` were different in every iteration prior to appending
- When defining a function inside a loop that uses the loop variable in its body, the loop function's closure is bound to the variable, not its value. So all of the functions use the latest value assigned to the variable for computation. - When defining a function inside a loop that uses the loop variable in its body, the loop function's closure is bound to the variable, not its value. So all of the functions use the latest value assigned to the variable for computation.
- To get the desired behavior you can pass in the loop variable as a named variable to the function. **Why this works?** Because this will define the variable again within the function's scope. - To get the desired behavior you can pass in the loop variable as a named variable to the function. **Why does this work?** Because this will define the variable again within the function's scope.
```py ```py
funcs = [] funcs = []