Skip to content

Instantly share code, notes, and snippets.

@jasonadu
jasonadu / 44.go
Created April 11, 2019 04:09 — forked from weppos/44.go
A Tour of Go Exercise: Fibonacci closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
f2, f1 := 0, 1
return func() int {
f := f2