Imports


In [1]:
import "fmt"

Hello World


In [2]:
world := "world"


Out[2]:
"world"

In [3]:
fmt.Sprintf("hello %s", world)


Out[3]:
"hello world"

Channels

Here is a simple example of a channel.


In [4]:
messages := make(chan string)


Out[4]:
(chan string)(0xc4200180c0)

In [5]:
go func() { messages <- "ping" }()

In [6]:
msg := <- messages


Out[6]:
"ping"