Misc Flashcards
1
Q
When using a custom setter, what is “field” ?
A
A backing field provided by Kotlin.
Used to hold the value of the property being set in memory (so the setter can manipulate it without losing the original value).
2
Q
Why use return@launch when using coroutines?
A
Non-labeled return statements return from the nearest (i.e. innermost) enclosing fun (ignoring lambdas).
If you want to return from any other function (a lambda or an outer fun) you have to specify it as a label at return statement.
scope.launch{ } is a lambad, so returning form it requires return@launch.