Created
October 25, 2020 03:28
-
-
Save 0xc0d/8e7d3adf5aab0600040c3198cc371442 to your computer and use it in GitHub Desktop.
Using goroutines on loop iterator variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list := []int{1, 2, 3} | |
for _, v := range list { | |
go func() { | |
fmt.Printf("%d ", v) | |
}() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment