Key Concepts

Review core concepts you need to learn to master this subject

Functions

fun greet() { println("Hey there!") } fun main() { // Function call greet() // Prints: Hey there! }

A function is a named, reusable block of code that can be called and executed throughout a program.

A function is declared with the fun keyword, a function name, parentheses containing (optional) arguments, as well as an (optional) return type.

To call/invoke a function, write the name of the function followed by parentheses.

Functions
Lesson 1 of 1

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo