A

Admin • 828.03K Points
Coach

Q. How do you define a function that returns nothing in Kotlin?

  • (A) fun myFunc(): void
  • (B) fun myFunc(): null
  • (C) fun myFunc(): Unit
  • (D) fun myFunc(): Nothing
  • Correct Answer - Option(C)
  • Views: 4
  • Filed under category Kotlin
  • Hashtags:

Explanation by: Admin
'Unit' is used as the return type for functions that return nothing.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.