A

Admin • 828.03K Points
Coach

Q. What is the purpose of the Elvis operator (?:) in Kotlin?

  • (A) Loops through a list
  • (B) Checks types
  • (C) Provides a default value when a variable is null
  • (D) Compares strings
  • Correct Answer - Option(C)
  • Views: 8
  • Filed under category Kotlin
  • Hashtags:

Explanation by: Admin
Elvis operator (?:) returns the default value if the left-hand side is null.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.