Guest User

Untitled

a guest
Jan 23rd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import kotlinx.coroutines.*
  2.  
  3. fun main() = runBlocking {
  4. launch {
  5. println("Result: ${fakeQuery()}")
  6. }
  7. println("Main thread here")
  8. }
  9.  
  10. suspend fun fakeQuery(): Int {
  11. delay(3000L)
  12. println("Query is completed")
  13. return 1
  14. }
  15.  
  16. /* Output
  17. Main thread here
  18. Query 1 is completed
  19. Result: 1
  20. */
Add Comment
Please, Sign In to add comment