package main
import "fmt"
func fib(n int) int {
if n <= 1 {
return n
}
a, b := 0, 1
for _i := 0; _i < n-1; _i++ {
a, b = b, a + b
}
return b
}
func main() {
fibs := []int{}
for n := 0; n < 10; n++ {
fibs = append(fibs, fib(n))
}
fmt.Println(fibs)
}
To embed this project on your website, copy the following code and paste it into your website's HTML: