What would be an alternative way, other than calli...
# getting-started
a
What would be an alternative way, other than calling kotlin.run { } ? Is there a better syntax sugar for this ?
Copy code
query.findFirst()?.let {
    emit(RepositoryState.SuccessState(it.toTestSession()))
} ?: kotlin.run {
    emit(RepositoryState.ErrorState.NotFound<TestSession>())
}
h
variable + if/else. It’s easy to read (and to debug). Don’t overuse the scope functions.
👀 1
5
y
Copy code
emit(query.findFirst()?.let {
    RepositoryState.SuccessState(it.toTestSession())
} ?: RepositoryState.ErrorState.NotFound<TestSession>())
3
a
🙂
thank you @Youssef Shoaib [MOD]