Coroutines for beginners: the only article you’ll need to get started!

Faheem un nisa
BYJU’S Exam Prep Engineering
7 min readMay 2, 2021

--

When we shifted to Kotlin at Gradeup, we realised that the www was pretty unfriendly for a coroutine beginner- there was a lot of information available but one had to really go through a ton of articles for Coroutines to start making any sense! I often ended up fumbling through the internet, having words like scope, dispatchers, builder, asyncawaitsuspendaaaaaaaah! thrown in my face, and after I could finally decipher Coroutines, I decided to use my bad experience to create a good one for all the fellow Coroutine-noobs out there. So here’s presenting this comprehensive article!

We shall be covering the following:

  1. What are Coroutines?
  2. Suspend functions.
  3. Coroutine Builders.
  4. Coroutine Dispatchers.
  5. Coroutine Scope.
  6. Coroutine Jobs.
  7. Error handling in Coroutines.

1. Say, what are Coroutines?

Coroutines are “light weight threads” : if you say that one more time, I am going to hang myself, pun intended :D

If you have searched for Coroutine tutorials online, chances are that you must have come across this oversimplified statement: Coroutines are light weight

--

--