This question already has an answer here:
This is the below code:
func main() {
values := []int{1, 2, 3, 4}
for _, v := range values {
go func(x int) {
fmt.Println(x)
}(v)
}
}
If this code have not go
keyword, it will print 1, 2, 3, 4
.
But it can not print any code now, why?
go version: 1.5.2 darwin/amd64
</div>