Continuing with our lockdown learning of Go language. Here’s a video where we discussChannels in Golang
package main
import "fmt"
func main() {
//Channels are pipelines used to communicate with goroutines
//channel is used to pass and receive integer data
var channel chan int
fmt.Println(channel)
//Initialized using make
channel = make(chan int)
fmt.Println(channel)
//You can send data to a channel using <-
channel <- 10
//You can receive data from a channel using <-
data := <- channel
fmt.Println(data)
//Send, receive operations are blocking
//So you need to have a goroutine receiving and sending data
//Let's discuss that in the next video
}
You can watch other videos in Go lang in the links below