Source file tour/moretypes/exercise-fibonacci-closure.go
1 //go:build nobuild || OMIT 2 3 package main 4 5 import "fmt" 6 7 // fibonacci is a function that returns 8 // a function that returns an int. 9 func fibonacci() func() int { 10 } 11 12 func main() { 13 f := fibonacci() 14 for i := 0; i < 10; i++ { 15 fmt.Println(f()) 16 } 17 } 18