> No. The code is completely consistent: the closures are different instances of a function that returns the value of 'number' at the moment it gets called. Not the value of 'number' when it gets created.
Isn't that exactly what GP said? And gave an example how to create that effect explicitly in functional languages, using refs?
Isn't that exactly what GP said? And gave an example how to create that effect explicitly in functional languages, using refs?