함수 생성

//kiss.kts

fun greet() = "hello"
println(greet())

val message: Int = greet() // Error
//type mismatch: inferred type is String but Int was expected

fun goodGreet(): String = "Hello"

모든 함수는 표현식이다

//inferunit.kts

fun sayHello() = println("Well, hello")
val message: String = sayHello() //ERROR
//type mismatch: inferred type is Unit but String was expected

fun goodSayHello(): Unit = println("Well, hello")
val message: Unit = sayHello()
println("The result of sayHello is $message")

파라미터 정의하기