HackerTrans
TopNewTrendsCommentsPastAskShowJobs

tmazeika

no profile record

comments

tmazeika
·قبل 4 سنوات·discuss
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.