What would be like in coroutines in case I want to...
# coroutines
k
What would be like in coroutines in case I want to do one job first -> wait that to finish -> then 2 other jobs later?
g
launch { doSomething() // suspend function launch { doSomethingElse1() } launch { doSomethingElse2() } }
or if you want to be a bit more explicit (and you also need result of those 2 jobs, if they has the same type)
Copy code
doSomething()

awaitAll(
  async { doSomethingElse1() },
  async { doSomethingElse2() },
)
👍 1
j
trailing comma… living on the edge🤘
😆 4
g
Actually we didn’t migrate to Kotlin 1.4, just copy-paste 😆 One more confirmation why trailing coma is a good language feature 🙈
🤔 1
r
Not sure what you mean by two jobs later, but you can just launch and do 3 suspend functions. One won't be executed until the previous competes
👍 1
k
Yeah. Just a thought in mind. I aint do it yet. Still looking for a complete solution :))