package main // exercise link: https://go.dev/tour/moretypes/26 import "fmt" // fibonacci is a function that returns // a function that returns an int. func fibonacci() func() int { first := 0 second := 1 return func() int { second += first first = second - first return first } } func main() { f := fibonacci() for i := 0; i < 10; i++ { fmt.Println(f()) } }