Each closure has its own locals, yay!
This commit is contained in:
parent
b53879a0fb
commit
4c196c93d9
@ -16,8 +16,10 @@ func fibonacci() func() int {
|
||||
}
|
||||
|
||||
func main() {
|
||||
f := fibonacci()
|
||||
f1 := fibonacci()
|
||||
f2 := fibonacci()
|
||||
for i := 0; i < 10; i++ {
|
||||
fmt.Println(f())
|
||||
fmt.Println("f1 ->", f1())
|
||||
fmt.Println("f2 ->", f2())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user