Function Types & Literals

Higher order functions, function types, function literals, anonymous functions, lambdas, closures, lexical scope, function references and comparing anonymous functions vs. lambdas

Gabriel Shanahan
The Kotlin Primer

--

— — — — — — — — — — — — — — —

THE CURRENT VERSION OF THIS ARTICLE IS PUBLISHED HERE.

— — — — — — — — — — — — — — —

Tags: #FYI++ #EXERCISE

This article is part of the Kotlin Primer, an opinionated guide to the Kotlin language, which is indented to help facilitate Kotlin adoption inside Java-centric organizations. It was originally written as an organizational learning resource for Etnetera a.s. and I would like to express my sincere gratitude for their support.

It is recommended to read the Introduction before moving on. Check out the Table of Contents for all articles.

In Kotlin, functions are first-class, which means they can be treated the same way as any other value type.

This means:

  • They can be assigned to variables
  • They can be passed as arguments to, and returned from, other functions. Functions…

--

--