October 2018
Intermediate to advanced
370 pages
9h 15m
English
This is the simplest form of a function. See the following example:
fun sayHello(){ println("Hello from Kotlin") }
If a function does not return a value, the Unit keyword can be declared right after the function name.
The Unit keyword is optional. If no keyword is mentioned, Kotlin will consider Unit as a default value:
fun sayHello() : Unit{ println("Hello from Kotlin")}
Read now
Unlock full access