<@U1ACUDMA8> yeah, the elvis operator definitely s...
# announcements
a
@barrongineer yeah, the elvis operator definitely solves part of the problem, but the thread @jw linked outlines a few more use cases. Sounds like it's normal if/else's or nested let's for now.
e
Don’t forget solutions with normal
val smth = ....
. You can also do early return. Works great when you judiciously apply “introduce function” refactoring to your code
a
If you have time, would you mind elaborating on what you mean by using early return?
k
Something like this:
Copy code
val a = couldBeNull ?: return
val b = anotherNullable ?: return

// Now, a and b are not null
a
@kingsley that sounds like a good answer to swifts guard,
K 1