One, named parameters, the default parameter values, variable parameter
1.1, named arguments
In order to enhance the readability of the code, Kotlin allows us to use named parameters, namely when calling a function, may be marked with the name of the function parameters, thereby clearly express the meaning and role of this parameter, but specifies the name of a parameter after all arguments after all need to indicate the name
1.2, the default parameter values
You can specify a default value for the parameter when declaring the function, in order to avoid creating overloaded function
Only at the end of the row of the above parameters for this example, according to the conventional call when the syntax must follow the order of the arguments to the function declaration defines a given parameter may be omitted
If a parameter named parameters, can omit any parameter has a default value, but may be required in any order of the incoming
1.3, variable parameters
The variable parameters allows us to package any number of arguments passed to the array function, Kotlin compared to Java syntax is different, instead of variable parameters declared by using the keyword varage
For example, the following function call in several ways are correct
In Java, the array may be directly passed to variable parameters, and require explicit Kotlin unpacked array, so that each array element in the function can be invoked as a separate parameter, this function is called to expand operator, using way is to add a * before array parameter
1.4, local function
Kotlin supports nested functions in the function, the nested function is called a local function