<@U3T6LDWTD> Maybe this example would explain what...
# language-proposals
j
@benleggiero Maybe this example would explain what I was trying to get with at, and why
let
is superior to `if`:
Copy code
var someOptional : String? = null

fun badFunc() {
        someOptional = null
}

fun optionalTest() {
       someOptional = "Foo"
        if(someOptional != null) {
                badFunc() //some idiot added this function  
                //prints "null". Idiot broke my code!
                println(someOptional)
        }


        someOptional = "Bar"
        someOptional.let { someOptional ->
                badFunc() //some idiot added this function  
                //prints "Bar". Idiot proof!
                println(someOptional)
        }
}