Created
September 24, 2017 23:58
-
-
Save tilaklodha/4c322e5207b435ecd6f6288f3ab8b5cc 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 print(ch chan bool) { | |
fmt.Println("Printing from goroutine") | |
ch <- true | |
} | |
func main() { | |
ch := make(chan bool) | |
go print(ch) | |
<-ch | |
fmt.Println("Printing from main") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment