Kotlin’s Unit type represents a function result with no meaningful information. It has exactly one value, also called Unit, and Kotlin returns that value implicitly. A block-bodied function can omit the return type; writing Unit makes the intent explicit. section 8.1.6
Returning Unit
fun logMessage(message: String): Unit { println(message) } fun logMessageBriefly(message: String) { println(message) } Both functions return Unit. In ordinary non-generic functions, Kotlin commonly compiles Unit-returning functions to JVM void methods, preserving familiar Java interoperability. section 8.1.6
Unit differs from Java’s void because it is a full-fledged type and can appear as a type argument. This makes it useful when a generic interface requires a result type but an implementation produces no meaningful result. section 8.1.6
interface Processor<T> {
fun process(): T
}
class NoResultProcessor : Processor<Unit> {
override fun process() { #1
// do stuff
} #2
}
Use Unit to implement a result-producing generic interface when processing performs work without returning useful data. section 8.1.6
Function types make Unit especially visible:
- A regular function may omit Unit because the compiler can infer it. section 8.1.6
- A function type must state its return type explicitly: () -> Unit. section 10.1.1
- Do not confuse Unit with Nothing: Unit has one value, whereas Nothing describes functions that do not terminate normally. section 8.1.6 section 8.3






