Skip to content
Quiz · Goroutines and channels · lesson 7 of 13

Quiz — range over a closed channel

What does the program print?

GO
package main

import "fmt"

func main() {
    ch := make(chan int, 1)
    ch <- 7
    close(ch)
    for v := range ch {
        fmt.Print(v)
    }
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way