Quiz

Quiz yourself on the concepts of channels.

We'll cover the following...
Technical Quiz
1.

What will be the output of the program mentioned below?

package main

import "fmt"

func main() {
	var ch chan string
	var count int

	go func() {
		ch <- "Hi"
	}()

	go func() {
		count++
		close(ch)
	}()

	<-ch
	fmt.Println(count)
}
A.

The program will exit because of panic.

B.

1

C.

Can’t compile

D.

0


1 / 3