Skip to content

Glossary: Kotlin Basics

?: (Elvis operator)

Also written: Elvis operator, ?:

`?:` gives a fallback value when the expression on its left is null. For example, `phone ?: "no phone"` gives "no phone" when phone is null.

Where the book teaches it

Related terms

null