How can this closure test be written in other languages?
- by Jian Lin
I wonder how the following closure test can be written in other languages, such as C and Java. Can the same result be expected also in Perl, Python, and PHP?
Ideally, we don't need to make a new local variable such as x and assign it the value of i inside the loop, but just so that i has a new copy in the new scope each time. (if possible). …