channel 1

What does the following program print?
package main

func main() {
	c := make(chan int, 1)
	for done := false; !done; {
		select {
		default:
			print(1)
			done = true
		case <-c:
			print(2)
			c = nil
		case c <- 1:
			print(3)
		}
	}
}

Choices:

Answer: 321

Run it on Go play.

Key points: