xref: /aosp_15_r20/external/kotlinx.coroutines/kotlinx-coroutines-core/jvm/test/guide/example-cancel-08.kt (revision 7a7160fed73afa6648ef8aa100d4a336fe921d9a)

<lambda>null1 // This file was automatically generated from cancellation-and-timeouts.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleCancel08
3 
4 import kotlinx.coroutines.*
5 
6 fun main() = runBlocking {
7     val result = withTimeoutOrNull(1300L) {
8         repeat(1000) { i ->
9             println("I'm sleeping $i ...")
10             delay(500L)
11         }
12         "Done" // will get cancelled before it produces this result
13     }
14     println("Result is $result")
15 }
16