Grasp Kotlin’s Coroutines With This Short Tutorial

Kotlin is a relatively new programming language; a derivative of Java with lots of little handy functional bits such as coroutines. [Foalyy] is porting an app to Android and learning Kotlin at the same time, and after wrapping their mind around coroutines, has written up a concise five-part tutorial on them.

Coroutines in Kotlin are a way to simplify writing asynchronous code, which is code that doesn’t necessarily execute in the order it is written. Coroutines are like light-weight threads that can be launched and managed easily, making it simpler to bridge together blocking and non-blocking code. (However, coroutines are not threads. They are more akin to suspending functions that play very well together.)

[Foalyy] found that the official Kotlin documentation on coroutines went into great detail on how coroutines function, but wanted a more bottom-up approach to understanding how they work and can be used. Luckily for anyone who thinks the same way, [Foalyy] wrote it all up and begins with a great recap of important elements, but if you prefer you can jump straight to the examples.

Kotlin has been around for a while, and readers with sharp memories may recall it was featured in this excellent introduction to what neural networks are and how they work.