Skip to content

Instantly share code, notes, and snippets.

@levicole
Created August 6, 2013 16:51
Show Gist options
  • Save levicole/6166310 to your computer and use it in GitHub Desktop.
Save levicole/6166310 to your computer and use it in GitHub Desktop.
learning concurrency in GO
package main
import "fmt"
func main() {
channela := make(chan int)
go func() {
for {
number := <- channela
fmt.Printf("%d\n", number)
}
}()
for i := 0; i < 10; i += 1 {
channela <- i
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment