kotlin methods and functions 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: make function kotlin
fun main() {
println("This is a function")
}