Skip to content

Instantly share code, notes, and snippets.

@Raghav2211
Created September 7, 2020 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raghav2211/184bfe44cd49cb42efc45286a22213ae to your computer and use it in GitHub Desktop.
Save Raghav2211/184bfe44cd49cb42efc45286a22213ae to your computer and use it in GitHub Desktop.
func fibonacci() func() int {
f1,f2 := 0,1
return func() int {
f2 , f1 = (f1+f2), f2 // https://golang.org/ref/spec#Order_of_evaluation
return f1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment