Chapter 9. Kotlin Functions
Functions are the building blocks of our apps. We write functions that do specific tasks, and then call them when we need to execute that specific task. As the tasks we need to perform in our apps will be quite varied, our functions need to cater to this and be very flexible. Kotlin functions are very flexible, more so than the other Android-related languages. We therefore need to spend a whole chapter learning about them. Functions are intimately related to object-oriented programming, and once we understand the basics of functions, we will be in a good position to take on the wider learning of object-oriented programming.
This is what we have in store for this chapter:
- Function basics and recap
- Function return types and the return keyword
- Single-expression functions
- Default arguments
- More function-related topics
We know a little bit about functions already, so a recap is in order.