Basic Functions

Learn how to modularize chunks of code into functions and how to call your functions in Kotlin. Understand the difference between function signatures and function declarations.

Functions separate useful chunks of code into a named entity you can reference in your code. Along with variables, they are the absolute fundamental language construct to avoid code duplication.

Function Signatures #

A function signature defines a function’s name, inputs, and outputs. In Kotlin, it looks like this:

Get hands-on with 1000+ tech skills courses.