kotlin return value in fun code example
Example 1: function kotlin
// Declare a function in Kotlin
fun happyBirthday(name: String, age: Int): String {
return "Happy ${age}th birthday, $name!"
}
// Call function
val greeting = happyBirthday("Anne", 32)
Example 2: return type in kotlin function
//Function having two Int parameters with Int return type
fun sum(a: Int, b: Int): Int {
return a + b
}