Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import kotlinx.coroutines.*
- fun main() = runBlocking {
- launch {
- println("Result: ${fakeQuery()}")
- }
- println("Main thread here")
- }
- suspend fun fakeQuery(): Int {
- delay(3000L)
- println("Query is completed")
- return 1
- }
- /* Output
- Main thread here
- Query 1 is completed
- Result: 1
- */
Add Comment
Please, Sign In to add comment