Kotlin: understanding null safety

Example:

var name: String? = "John"
Kotlin aims to eliminate the danger of null references.

Solution:

print(name?.length)

Beginner's Guide to Kotlin