Created
September 7, 2020 08:30
-
-
Save Raghav2211/184bfe44cd49cb42efc45286a22213ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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