'What's the deal with `return` followed by @ and reference to outer block?
There are multiple occurrences of return@something, like the following:
withContext(Dispatchers.IO) {
doSomething(task)
return@withContext action(task)
}
what does this @withContext mean? If I try to move return up, like this, it does not compile:
return withContext(Dispatchers.IO) {
doSomething(task)
action(task)
}
Solution 1:[1]
withContext calls the specified suspending block with a given coroutine context, suspends until it completes, and returns the result.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cas |
