Aaron Waller
08/09/2021, 9:58 AMwith(GlobalScope){ launch{} }
and GlobalScope.launch{}
? All I can find is: "You can use with()
in order to avoid the repetition of the GlobalScope
receiver" but I don't really get it.
Thanks in advanceandylamax
08/09/2021, 10:03 AMwith(GlobalScope) {
// . . .
}
You are gonna have to add launch like so
with(GlobalScope) {
launch {
// . . .
}
}
While you can just launch a new coroutine like so
GlobalScope.launch {
// . . .
}
Aaron Waller
08/09/2021, 10:05 AMwith(GlobalScope){ launch{} }
?andylamax
08/09/2021, 10:07 AMGlobalScope.launch
you are not getting any benefit by using with
if all you are trying to do is just launch a corountineGlobalScope
create your own scope if possiblemarstran
08/09/2021, 10:22 AMwith
function is a stdlib function, not a coroutine function. Your examples will behave exactly the same.PHondogo
08/09/2021, 10:26 AM