And yeah, if you want to have else, you can do thi...
# announcements
g
And yeah, if you want to have else, you can do this:
Copy code
val foo1 = foo?.first?.second?.third?.fourth?.fifth
if (foo1 != null) {
   foo1.doSomething()
} else {
   otherStuff()
}
Yes, one line more, but still not sure that this much better:
Copy code
if (val foo1 = foo?.first?.second?.third?.fourth?.fifth) {
foo1.doSomething()
} else {
otherStuff()
}
One line less and scoped foo1, not so bad.