Last active
July 23, 2020 18:22
-
-
Save cjavilla-stripe/4b5e26cc5a8a53f39bb3568acd1d101c to your computer and use it in GitHub Desktop.
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 | |
import ( | |
"fmt" | |
) | |
func a(x chan int) { | |
fmt.Println("a") | |
x <- 9 | |
} | |
func b(y chan int) { | |
fmt.Println("b") | |
y <- 10 | |
} | |
func main() { | |
c := make(chan int) | |
go a(c) | |
go b(c) | |
x, y := <-c, <-c | |
fmt.Println(x, y) | |
fmt.Println("done") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment