10 Higher-order functions:Lambdas as parameters and return values

This chapter covers

  • Function types
  • Higher-order functions and their use for structuring code
  • Inline functions
  • Non-local returns and labels
  • Anonymous functions

You were introduced to lambdas in chapter 5, where you explored the general concept, and dove deeper into the standard library functions that use lambdas in chapter 6. Lambdas are a great tool for building abstractions, and, of course, their power isn’t restricted to collections and other classes in the standard library. In this chapter, you’ll learn how to create higher-order functions—your own functions that take lambdas as arguments or return them. You’ll see how higher-order functions can help simplify your code, remove ...

Get Kotlin in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.