This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| // Below is a function `sum()` that takes a number, runs a loop to add, and returns the result. | |
| // In the main function, we call `sum()` once with a small number (e.g. 1000) and once | |
| // with a large number (e.g. 1000000000) and prints the result. After that, the main() | |
| // prints the string "All Done!" | |
| // Your job is to convert the main() so that we call sum() concurrently, but wait for all the invocations | |
| // to sum() to complete before printing "All Done". |
OlderNewer