...

/

Solution Review: Demonstrate the Blocking Nature

Solution Review: Demonstrate the Blocking Nature

This lesson discusses the solution to the challenge given in the previous lesson.

We'll cover the following...
Go (1.6.2)
package main
import "fmt"
import "time"
func main() {
c := make(chan int)
go func() {
time.Sleep(5 * 1e9)
fmt.Println("received", <- c) // value recieved from channel
}()
fmt.Println("sending", 10)
c <- 10 // putting 10 on the channel
fmt.Println("sent", 10)
}

At line 6, we make a channel c for integers. Then, from line 7 to line 10, we start a ...