Created
September 23, 2014 16:23
-
-
Save buth/12a06bd02616b9671b69 to your computer and use it in GitHub Desktop.
go-routine / channel puzzle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func send(c chan int, i int){ | |
c <- i | |
} | |
func main() { | |
c := make(chan int) | |
go send(c, 1) | |
go send(c, 2) | |
<-c // Always 1? | |
<-c // Always 2? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment