Referring to the Go Tutorial, Go has closures, which allows us to return functions that can access and bound to the variables outside of their bodies. Basically, the variable is distinct among different specific instance of closures.
Here is an implementation of the function fibonacci
that prints successive fibonacci numbers using a closure (from Go Tutorial exercise):
|
|