DEV Community


Discussion on: Kotlin by examples: Class and Properties

leolas95 profile image
Leonardo Guedez

Nice article! Been considering learning Kotlin or Scala for Android recently, to try something different.

Also, I don't know if it's a typo, but in the example:

You can safely access a property that can be null with the keyword ‘?’:

var mutable = "mutable"
println(mutable.legnth)                 -> 'print 7'
var mutableCanBeNull: String? = null
println(mutableNull?.length)            -> 'does not crash! print null'

The last line shouldn't be mutableCanBeNull? instead of mutableNull? ?

dbottillo profile image
Daniele Bottillo Author

Hi Leonardo, thanks for your message! yes it was, I've updated the post...!