July 2018
Intermediate to advanced
266 pages
7h 11m
English
As mentioned earlier, a job is, by default, started automatically both when it's created using launch() and when it's created using Job(). In order to create a job without starting it, you have to use CoroutineStart.LAZY when creating it. Consider the given example:
fun main(args: Array<String>) = runBlocking { launch(start = CoroutineStart.LAZY) { TODO("Not implemented yet!") } delay(500)}
When running this snippet of code, you will note that it didn't print any errors. Since the job is created but never started, the exception will not be thrown:

Read now
Unlock full access