Profile
August 14, 2022

How to use Elvis Operator in Kotlin

Elvis Operator is a most frequently used operator which is denoted by “?:”, its appropriate use is when an object is declared nullable.

 

 

How to use Elvis Operator?

 

object ? :  "return something if object is null”

Example:

var abc: String? = null
abc?:"hello world"

 

 

Checkout Our Latest Tools

 

APK Decompiler

Java Decompiler

Email Validator

APK Downloader

Last edited on August 14, 2022 by Admin

Latest articles