I've got two `Channel`s, how can zip them, as I ca...
# coroutines
r
I've got two `Channel`s, how can zip them, as I can only proceed once I get a response from both?
k
Copy code
for (one in channel1) { 
  for (two in channel2) {
    doSomething()
  }
}
r
Won't that repeat the same code with
one
in case
two
sends something again?
k
Oh rip you are right.
You could do the following:
Copy code
for (one in channel1) {
  val two = channel2.recieve()
  doSomething(one, two) 
}
r
Works nicely 👌