Different results on similar code with safe call operator in Kotlin
I'm new to Kotlin and these two below codes give different results.
fun main() {
var name: String? = "Denis"
name = null
print(name?.toLowerCase())
}
Output: Compilation Error (illegal access operation)
fun main() {
var name: String? = null
print(name?.toLowerCase())
}
Output: null