Skip to content

Instantly share code, notes, and snippets.

@dorkalev
Created February 10, 2014 23:13
Show Gist options
  • Save dorkalev/8926160 to your computer and use it in GitHub Desktop.
Save dorkalev/8926160 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func fibonaci(l uint) {
var fibo func(arr []uint, l uint)
fibo = func(arr []uint, l uint) {
if l == 0 {
fmt.Println(1)
} else if l == 2 {
fmt.Println(arr[1])
} else if l > 2 {
fibo([]uint{arr[1], (arr[0] + arr[1])}, l-1)
}
}
fibo([]uint{1, 1}, l)
}
func main() {
fibonaci(7)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment