Concurrency / Hello World goroutine / Essential Go

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "fmt" "time" ) func main() { // create new channel of type string ch := make(chan string) // start new anonymous goroutine go func() { time.Sleep(time.Second) // send "Hello World" to channel ch <- "Hello World" }() // read from channel msg, ok := <-ch fmt.Printf("msg='%s', ok='%v'\n", msg, ok) }
Editor Settings
Theme
Key bindings
Full width
Lines