Unit
corresponds to the void
keyword in Java.
What is a Unit
in Kotlin?
If you have a function that does not return a value, you can return a Unit
object.
Generally, you would return a Unit
in Kotlin where you would traditionally return a void
in Java.
fun doesntReturnAnythign(): Unit {
val one = 1
}