Created
September 12, 2018 17:04
-
-
Save rogerwelin/70a5de21a2e36ff77df53edee875049f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| ) | |
| func main() { | |
| greeks := []string{"plato", "socrates", "aristotle", "archimedes", "pythagoras", "democritus"} | |
| var wg sync.WaitGroup | |
| fmt.Println("Init") | |
| for _, ph := range greeks { | |
| wg.Add(1) | |
| go func() { | |
| defer wg.Done() | |
| fmt.Println(ph) | |
| }() | |
| } | |
| wg.Wait() | |
| fmt.Println("End") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment