Hello, everyone, I have a piece code like below, I...
# getting-started
l
Hello, everyone, I have a piece code like below, I want to know that whether the
::a.isInitialized
is true or not when the exception is throw.
Copy code
private lateinit var a: B

fun main() {
    try {
        a = B()
    } catch (e: Exception) {
    }
}
s
Well, an easy way to find out would just be to run it
The answer's no, assignment can only happen after the right-hand-side expression is evaluated. If the evaluation fails, there's nothing to assign.
🫡 1