Channels | Learn Go #42
Replies: 1 comment
-
Hi Karan, Thanks for writing this course, it is super helpful. A quick question on this topic. The following code snippet works, func main() {
ch := make(chan string)
go func() {
ch <- "Hello"
}()
fmt.Println("message", <-ch)
} However, this doesn't func main() {
ch := make(chan string)
ch <- "Hello"
fmt.Println("message", <-ch)
} The only difference is sending a message via a new go routine vs. the same go routine (main). Just curious. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Channels | Learn Go
In this tutorial, we will learn about channels in Go
https://www.karanpratapsingh.com/courses/go/channels
Beta Was this translation helpful? Give feedback.
All reactions