mchirico / zDaily

Playground to hack and test ideas with Zoe
1 stars 2 forks source link

Day 17: Working with Channels #19

Open mchirico opened 3 years ago

mchirico commented 3 years ago

Create Simple Go Channel Examples

Video

https://repl.it/talk/share/Channel-Return-Results/60513

https://repl.it/talk/share/Channel-with-select/60519

tacomonkautobot[bot] commented 3 years ago

mchirico, Thanks for opening this issue!

ZoeChiri commented 3 years ago

package main

import "fmt"

func main() {

messages := make(chan string)

go func() { messages <- "channel practice" }()

msg := <-messages
fmt.Println(msg)

}