Sobes.tech
Junior — Senior

What output will the program produce

livecode

Task condition

Determine what values will be printed when running the following Go code that uses a buffered channel.

func main() {
  ch := make(chan int, 5)
  for i := 1; i <= 5; i++ {
    ch <- i
  }

  for true {
    fmt.Println(<-ch)
  }
}