Our example demonstrates how to use goroutines, which are lightweight threads of execution. Here’s the translation into ActionScript.
To run this ActionScript program, you will need an environment that supports ActionScript, such as Adobe Animate or an ActionScript compiler. Place the code in a .as file and run it.
When we run this program, we see the output of the blocking call first, then the output of the two goroutines. The goroutines’ output may be interleaved, because setTimeout functions are being run concurrently by the ActionScript runtime.
Next, we’ll look at a complement to goroutines in concurrent programs: channels.