Is it possible to implement repeatable task (with ...
# coroutines
i
Is it possible to implement repeatable task (with interval) using coroutines?
Copy code
// Run job that prints "ABC" string every 1000ms
val repeatJob = repeatJob(1000) { println("ABC") }

//until job is canceled
repeatJob?.cancel()
d
No official solution at the moment. See https://github.com/Kotlin/kotlinx.coroutines/issues/1632#issuecomment-674415069 If your task is very short or time precision is not an issue, you may be better off without the inner
launch
block.