Junior — Senior
Competitive doubling of a number using only channels
livecode
Task condition
There is a global variable (integer) and ten goroutines, each of which:
- Multiplies this variable by 2.
- Stops when the value reaches or exceeds 1000. The main goroutine must terminate all other goroutines and output the final result.
Requirements:
- It is forbidden to use sync packages (mutexes, WaitGroup) and sync/atomic.
- The entire synchronization and data transfer mechanism must be built solely on channels.