https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

marcelo

11/05/2018, 6:11 PM
Trying to get this coroutines. On this code. Why do I have to specify
return@time
? Is it because my suspended coroutine is called time? Also, why can't I do the following:
Copy code
return when(process.exitValue()) {
  0 -> {
         return resultsAdapter.fromJson(scanResults)
...
}
l

littlelightcz

11/05/2018, 6:13 PM
Hmm and if you remove
return@time
completely, does it compile?
m

marcelo

11/05/2018, 6:19 PM
negative! I need to have
return@time
return returns from the nearest enclosing function
non-local returns need to be labeled
m

marcelo

11/05/2018, 6:25 PM
Nice, thanks @kevinherron
4 Views