I am confused why the following code does not print out iterated value.
test:= []int{0,1,2,3,4}
for i,v := range test{
go func(){
fmt.Println(i,v)
}
}
What I think is that it should print out
0 0
1 1
2 2
3 3
4 4
But instead, it printed out
4 4
4 4
4 4
4 4
4 4