Solution Review: Demonstrate the Blocking Nature
This lesson discusses the solution to the challenge given in the previous lesson.
package mainimport "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 channelfmt.Println("sent", 10)}
Get hands-on with 1400+ tech skills courses.