|
|
|
|
|
by amscanne
3567 days ago
|
|
So does Go (use the first form). Saying "loop variables are scoped outside the loop" is incorrect. All the gotchas noted stem from the fact that people are using _closures_ in the form of go and defer statements, which capture i by reference unless you pass it as an argument. I think it's more an issue with closure gotchas (or the fact that go and defer statement aren't viewed that way) than with scoping. |
|