Beginner Go (Golang)
Q38 / 100

What is the purpose of sync.WaitGroup?

Correct! Well done.

Incorrect.

The correct answer is B) Waits for a collection of goroutines to finish using Add, Done, and Wait

B

Correct Answer

Waits for a collection of goroutines to finish using Add, Done, and Wait

Explanation

wg.Add(1); go func() { defer wg.Done(); }(); wg.Wait() blocks until all added goroutines call Done.

Progress
38/100