A goroutine is a lightweight thread of execution. Put go in front of a function call and it runs concurrently, while the rest of your code carries on:
go scout() // runs in the background
The catch: main won’t wait for goroutines on its own โ if it returns, they’re cut short. A sync.WaitGroup lets you wait: Add how many you expect, Done as each finishes, and Wait blocks until the count hits zero.
Your Quest
Launch a goroutine that prints Scout reporting! and then calls wg.Done(). The wg.Wait() already in place guarantees it finishes before the final line.
Expected output:
Scout reporting!
All scouts returned.
Hint
go func() { fmt.Println("Scout reporting!"); wg.Done() }().