Post

KotlinKotlin

j
jordan chris

Posted on 27th February 2024|47 views

0
votes

Elvis Operator Kotlin

How to use the Elvis operator?

Answers
P
Harshel Mike

Posted on 27th February 2024

The Elvis operator receives two inputs and returns the very first argument only if it is no-null, else it will return the second argument. The Elvis operators syntax is:

Fun elvisEx(arg : String){

Val value = arg : “”

}  

The primary advantage of Elvis operator is we can use it for conjunction including the safe call operator.

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos