15.2 How to Declare a Kotlin Function
A Kotlin function is declared using the following syntax:
fun <function name> (<para name>: <para type>, <para name>: <para type>, ... ): <return type> {
// Function code
}
This combination of function name, parameters and return type are referred to as the function signature or type. Explanations of the various fields of the function declaration are as follows:
•fun – The prefix keyword used to notify the Kotlin compiler that this is a function.
•<function name> - The name assigned to the function. This is the name by which the function will be referenced when it is called from within the application code.
•<para name> - The name by which the parameter is to be referenced in the function code.
•<para type> - The type of the corresponding parameter.
•<return type>...