https://kotlinlang.org logo
t

thijs

09/13/2016, 6:43 AM
I also do some iOS Swift development. I must say I kind of miss the
if let
construct from Swift. I'd love to be able to do something like this in Kotlin:
Copy code
class Foo {
    var bar: String? = //...
    var foo: String? = //...

    fun someMethod() {
        if (val bar = bar, val foo = foo) {
            // bar and foo are now non-optional
        }
    }
}