Lesson 1: Introduction to Kotlin
What this topic covers
Build and run Kotlin/JVM programs with Android Studio, using the JDK, a main function, variables, data types, and input. Apply nullable-value handling with the Elvis operator.
What does the Elvis operator ?: do when the left value is null?
The Elvis operator returns the value on its left when it is not null, and evaluates the fallback on its right only when that value is null. For example, println(name ?: "Guest") prints the fallback when name is null. It lets a program print a safe value instead of crashing.