probably silly question, if i remove the `job.canc...
# coroutines
c
probably silly question, if i remove the
job.cancel()
from this snippet in the coroutine docs, why does playground time out entirely?
Copy code
fun main() = runBlocking {
//sampleStart
    val job = launch {
        repeat(1000) { i ->
            println("I'm sleeping $i ...")
            delay(500L)
        }
    }
    delay(1300L) // delay a bit
    println("main: I'm tired of waiting!")
    job.cancel() // cancels the job
    job.join() // waits for job's completion 
    println("main: Now I can quit.")
//sampleEnd    
}
actually i think i naswered my own question, delay will add up
for the repeats
l
Because
runBlocking
waits for all children coroutines to complete
c
i would still expect it to print like the first 10 though..
instead of printing nothing
l
Playground shows the results only when the program is complete.
c
ahhh
thank you!
l
You may want to submit a feature request on kotl.in/issue