Junior — Senior
What output will the console display after running program №42
livecode
Task condition
What will be printed in the console when executing the following code:
func ProcessData(data[]int) {
results := make(chan int, len(data))
for _, val := range data {
go func(x int) {
time.Sleep(1 * time.Second)
results <- x * 2
}(val)
}
for i := 0; i < len(data); i++ {
fmt.Println(<-results)
}
}