Sobes.tech
Junior — Senior

Combining multiple channels into one

livecode

Task condition

It is necessary to implement a function merge that takes an arbitrary number of read-only input channels (<-chan int) and returns a single output channel of the same type. The function should guarantee that all values received on all input channels are passed to the resulting channel.

func merge(channels ...<-chan int) <-chan int {
    // ...
}