- What is the significance of the fun keyword?
- The fun keyword is used to denote the start of a function definition.
- How do you add a parameter to a function?
- You must add parentheses after the function name. Within the parentheses you must use the name:Type syntax.
- What are named arguments?
- When passing arguments, you can specify which parameter to assign an argument value by including the parameter name followed by = and then the value.
- What are default parameter values?
- You can specify a default value for a parameter that will be used if the parameter is omitted when passing arguments to a function call.
- How do you define a local function?
- You define it like a regular function but within another function.
- What is a top-level function?
- A function not associated with any class that is defined within any Kotlin file
- How do you define an infix function?
- You must add the infix keyword and ensure that the function takes only a single non-vararg parameter.
- What are higher-order functions?
- Functions that either return another function or take another function as a parameter.
- How do you define an extension function?
- You specify a receiver type to be associated with the function by using the Type.functionName syntax.