• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
<lambda>null2  * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 // This file was automatically generated from cancellation-and-timeouts.md by Knit tool. Do not edit.
6 package kotlinx.coroutines.guide.exampleCancel08
7 
8 import kotlinx.coroutines.*
9 
10 fun main() = runBlocking {
11     val result = withTimeoutOrNull(1300L) {
12         repeat(1000) { i ->
13             println("I'm sleeping $i ...")
14             delay(500L)
15         }
16         "Done" // will get cancelled before it produces this result
17     }
18     println("Result is $result")
19 }
20