We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e68a60 commit 7be93beCopy full SHA for 7be93be
42_goroutines/main.go
@@ -0,0 +1,35 @@
1
+package main
2
+
3
+import (
4
+ "fmt"
5
+ "sync"
6
+)
7
8
+var wg sync.WaitGroup
9
10
+func main() {
11
12
+ wg.Add(1)
13
14
+ go printX()
15
+ //fmt.Println()
16
+ wg.Wait()
17
+ printY()
18
+ //time.Sleep(time.Second)
19
20
+}
21
22
+func printX() {
23
+ for i := 0; i < 1000; i++ {
24
+ fmt.Print("X")
25
+ }
26
+ wg.Done()
27
28
29
+func printY() {
30
+ for i := 0; i < 20; i++ {
31
+ fmt.Print("Y")
32
33
34
35
+// main goroutine
0 commit comments