O'Reilly logo

Kotlin in Action by Svetlana Isakova, Dmitry Jemerov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required