S
S
SashaFarkas2019-02-24 19:52:47
Kotlin
SashaFarkas, 2019-02-24 19:52:47

Why does launch affect calling a method that doesn't depend on it?

Everything works perfectly.
5c72cb7fc7609799654215.png
I remove launch, and the application just gets up.
5c72cbd59ac11631623171.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Varakosov, 2019-02-24
@SashaFarkas

With launch, you start the sendString() suspend method (a coroutine, basically) to run asynchronously. Since the method contains an infinite loop, by running it synchronously you prevent the program from doing anything else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question