Chapter 3. Defining and calling functions

This chapter covers

  • Functions for working with collections, strings, and regular expressions
  • Using named arguments, default parameter values, and the infix call syntax
  • Adapting Java libraries to Kotlin through extension functions and properties
  • Structuring code with top-level and local functions and properties

By now, you should be fairly comfortable with using Kotlin the same way you use Java. You’ve seen how the concepts familiar to you from Java translate to Kotlin, and how Kotlin often makes them more concise and readable.

In this chapter, you’ll see how Kotlin improves on one of the key elements of every program: declaring and calling functions. We’ll also look into the possibilities for ...

Get Kotlin in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.