Check out example codes for "function kotlin". It will help you in understanding the concepts better.

Code Example 1

// 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)

Learn ReactJs, React Native from akashmittal.com