HackerTrans
トップ新着トレンドコメント過去質問紹介求人

tmazeika

no profile record

コメント

tmazeika
·4 年前·議論
The example makes sense when you think of `i` getting reassigned, but in other languages with variable shadowing (think Rust, but Go too when you're in a nested scope) you might replace `i = 2` with `let i = 2` (Rust), in which case the closure closes over precisely the `let i = 2` variable and the expected output differs.