Each closure has its own locals, yay!

This commit is contained in:
Dan Buch 2012-09-01 22:36:53 -04:00
parent b53879a0fb
commit 4c196c93d9

View File

@ -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())
}
}