Is somebody able to share an explanation for why t...
# coroutines
s
Is somebody able to share an explanation for why the test below prints
9a
9b
9c
9d
9e
9f
when it seemingly should be printing
1a
2a
3a
4a
5a
6a
7a
8a
before that?
Copy code
@Test
    fun example1(): Unit = runBlocking {
        val flowA = flowOf(1, 2, 3, 4, 5, 6, 7, 8, 9)
        val flowB = flowOf("a", "b", "c", "d", "e", "f").onEach { delay(1000) }

        flowA.combine(flowB) { a, b -> "$a$b" }.collect { println(it) }
    }
s
Because
combine
uses the most recent values: https://kotlinlang.org/docs/reference/coroutines/flow.html#combine
s
Ah, didn’t give attention to the impact of a
delay
on the first value of
flowB
. Thank you 🙌
t
check out
zip
2
1