Introduction to Functions in Kotlin
We'll cover the following...
Kotlin doesn’t insist that you create classes for everything. No one gets praise for duplicating code, but to reuse doesn’t mean building a class hierarchy. Unlike Java where a class is the smallest reusable piece, in Kotlin both standalone functions and classes can be reused.
Kotlin takes a highly pragmatic approach to creating good quality code—create small simple standalone functions where they suffice and roll your code into methods of classes only when necessary. In this chapter, we’ll focus on standalone functions for two reasons. First, because we ...