kotlin create function code example
Example 1: kotlin function
fun sum(a: Int, b: Int): Int {
return a + b
}
Example 2: 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)