Advertisement
Nicksed

Untitled

Jul 26th, 2023
1,035
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.23 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "sync"
  6. )
  7.  
  8. func printNumbers(wg *sync.WaitGroup) {
  9.     for i := 1; i <= 5; i++ {
  10.         fmt.Println(i)
  11.     }
  12.     wg.Done()
  13. }
  14.  
  15. func main() {
  16.     var wg sync.WaitGroup
  17.     wg.Add(1)
  18.     go printNumbers(&wg)
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement