KotlinFunctions


Syntax

  • fun Name(Params) = ...
  • fun Name(Params) {...}
  • fun Name(Params): Type {...}
  • fun <Type Argument> Name(Params): Type {...}
  • inline fun Name(Params): Type {...}
  • { ArgName: ArgType -> ... }
  • { ArgName -> ... }
  • { ArgNames -> ... }
  • { (ArgName: ArgType): Type -> ... }

Parameters

ParameterDetails
NameName of the function
ParamsValues given to the function with a name and type: Name:Type
TypeReturn type of the function
Type ArgumentType parameter used in generic programming (not necessarily return type)
ArgNameName of value given to the function
ArgTypeType specifier for ArgName
ArgNamesList of ArgName separated by commas