Sign in
go
/
talks
/
b88df1b0d81c57686e93202503e1d9236efb8bd2
/
.
/
2013
/
go4python
/
fib-gen.go
blob: 29d189e4790bf3fb4f0493728d70d50472eb6e20 [
file
] [
log
] [
blame
]
// +build OMIT
package main
import "fmt"
func fib(c chan int, n int) {
a, b := 0, 1
for i := 0; i < n; i++ {
a, b = b, a+b
c <- a
// HL
}
close(c)
}
func main() {
c := make(chan int)
go fib(c, 10)
// HL
for x := range c {
// HL
fmt.Println(x)
}
}