💄 Update Go sample file

This commit is contained in:
Kiliman
2019-07-24 09:48:00 -04:00
committed by unknown
parent 371be6a082
commit 7a3be9b579
+4 -17
View File
@@ -1,19 +1,6 @@
package main
import "fmt"
// fib returns a function that returns
// successive Fibonacci numbers.
func fib() func() int {
a, b := 0, 1
return func() int {
a, b = b, a+b
return a
}
}
func main() {
f := fib()
// Function calls are evaluated left-to-right.
fmt.Println(f(), f(), f(), f(), f())
for i := 0; i <= 9; i++ {
f := count(fact(gen(i)))
fmt.Println(i, "! =", f)
}
}