I'm new to Kotlin, and I don't know why the compiler complains about this code:
data class Test(var data : String = "data") fun test(){ var test: Test? = Test("") var size = test?.data.length }
The compiler complains about test?.data.length , it says what I should do: test?.data?.length . But the data variable is String , not String? so I donβt understand why I need to put ? when I want to check the length.
android kotlin data-class
Victor Manuel Pineda Murcia
source share