August 2021
Beginner
112 pages
1h 23m
English
| Puzzle 22 | Count Me a Million |
| | package main |
| | |
| | import ( |
| | "fmt" |
| | "sync" |
| | ) |
| | |
| | func main() { |
| | var count int |
| | var wg sync.WaitGroup |
| | |
| | for i := 0; i < 1_000_000; i++ { |
| | wg.Add(1) |
| | go func() { |
| | defer wg.Done() |
| | count++ |
| | }() |
| | |
| | } |
| | wg.Wait() |
| | fmt.Println(count) |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: 891239
Different Output | |
|---|---|
|
Your output might ... | |
Read now
Unlock full access