Skip to content

Instantly share code, notes, and snippets.

View joshuayoerger's full-sized avatar

Josh Yoerger joshuayoerger

View GitHub Profile
@joshuayoerger
joshuayoerger / exercise-fibonacci-closure.go
Last active October 11, 2018 08:42
Solution to GoTour Fibonacci Closure Exercise
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() (int) {
curr, next := 0, 1
return func() (ret int) {
ret = curr