In Kotlin is there an equivalent to the Swift code below?
if let a = b.val { } else { }
there are two answers above, both got a lot acceptances:
Both seem to work in most of the usages, but #1 would fail in the following test:
#2 seems better.