9 Standard Functions
Standard functions are general utility functions in the Kotlin standard library that accept lambdas to specify their work. In this chapter you will meet the six most commonly used standard functions – apply, let, run, with, also, and takeIf – and see examples of what they can do.
This is not a hands-on chapter, and you will not be adding to NyetHack or Sandbox. As always, however, we encourage you to experiment with the code examples in the REPL.
In this chapter we will refer to an instance of a type using the term receiver. This is because Kotlin’s standard functions are extension functions under the hood, and receiver is the term for the subject of an extension function. You will learn about extensions, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access