Answers for "what is unit type used for in kotlin"

1

what is unit type used for in kotlin

/* 
	Unit is used when the function basically return
    nothing of interest
*/

// Example
val MyName = "Johnny"

fun SayHey(): Unit {
	println("Hi, " + MyName)
}

fun main() {
	SayHey()
}
Posted by: Guest on April-11-2020

Browse Popular Code Answers by Language