-
-
Save le0nidas/d3059cd70754aa2ecea3b8ffac9e9dab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(): Unit = runBlocking { | |
launch { | |
val tasks = downloadTasks() | |
printTasks(tasks) | |
} | |
} | |
private suspend fun downloadTasks() { | |
println("Downloading...") | |
// code that makes a network call and returns the list of tasks | |
return listOf(Task(1), Task(2), Task(3)) | |
} | |
private fun printTasks(tasks: List<Task>) { | |
tasks.forEach { task -> println(task.id) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment