[Tested] Kotlin coroutine suspend example code

2023/08/21 22:31

Error

import kotlinx.coroutines.*

suspend fun job1() {
    delay(5000L)
    println("job 1")
}
suspend fun job2() {
    println("job 2")
}
fun main() {
    runBlocking {		
        job1()
        job2()
        println("End")
      }
}

Output

job 1
job 2
End

Leave a Reply

Back to top