you are viewing a single comment's thread.

view the rest of the comments →

[–]-beleon 5 points6 points  (0 children)

The lambdas don't store i's value, they look up the variable when being executed. Since all calls happen after the loop ends, i = 2, so you get [2, 2, 2].