Skip to content

Instantly share code, notes, and snippets.

@CanerPatir
Last active September 19, 2019 05:40
Show Gist options
  • Select an option

  • Save CanerPatir/97187c54a7d5f70efdde134e1b900a0c to your computer and use it in GitHub Desktop.

Select an option

Save CanerPatir/97187c54a7d5f70efdde134e1b900a0c to your computer and use it in GitHub Desktop.
suspend fun doOperation1() {
delay(1000L)
}
suspend fun getSomeResult(): String {
delay(2000L)
return "hello"
}
fun main(){
runBlocking {
doOperation1()
println("operation1 done after 1 second")
val result = getSomeResult()
println("operation2 done after 2 seconds and result: $result")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment