DEV Community

Discussion on: Kotlin by examples: Class and Properties

Collapse
 
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'
Enter fullscreen mode Exit fullscreen mode

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

Collapse
 
dbottillo profile image
Daniele Bottillo

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