Generation

generate functionThu, 24 Nov 2022

innertube play

import kotlinx.coroutines.flow.* import kotlinx.coroutines.* fun main() = runBlocking<Unit> { (1..5).asFlow() .map { request -> performRequest(request) } .collect { response -> println(response) } } suspend fun performRequest(request: Int): String { delay(1000) // imitate long-running asynchronous work return "response $request" }

Questions about programming?Chat with your personal AI assistant