Junior — Senior
Output of i values from goroutines with variable capture
livecode
Task condition
Determine which numbers the program will print, considering the behavior of the variable i's closure when goroutines are run in parallel.
func main() {
for i := 0; i < 10; i++ {
go func() {
fmt.Println(i)
}()
}
}