Complete the code to create a channel of integers.
ch := make([1])The make function is used to create channels in Go. The correct syntax is make(chan int) to create a channel of integers.
Complete the code to create a buffered channel of strings with capacity 5.
ch := make(chan string, [1])To create a buffered channel, you specify the capacity as the second argument to make. Here, the capacity is 5.
Fix the error in the channel creation code.
ch := make(chan int [1])The capacity argument must be separated by a comma inside the make function call. So it should be make(chan int, 5).
Fill both blanks to create a buffered channel of floats with capacity 8.
ch := make([1], [2])
chan int.The channel type is chan float64 for floats, and the capacity is 8 for buffering.
Fill all three blanks to create an unbuffered channel of booleans and assign it to variable done.
var done [1] done = make([2]) // Use the channel done[3] true
<-chan bool incorrectly.The variable done is declared as a channel of booleans chan bool. It is created with make(chan bool). The last blank is <- to send to the channel: done <- true.