Unit and modifiers
Now, we will talk about two basic elements that help us understand Kotlin a little better when working with OOP: Unit and modifiers.
Unit
A quick way to explain Unit to a Java developer is to say that it is similar to what we refer to as void in Java – that is, it represents the absence of a value when a function or method is returned. On a technical level, there are differences, although the fundamentals are the same.
Let’s look at a function that uses Unit; to do so, we will look at the previous code block for the functions we have defined:
fun printTitle(){
    println("Book title: $title")
}
fun markAsRead(readDate:String) {
    this.isRead = true
    this.readDate = readDate
}
fun getNumberOfPages(): Int {
    return pages
}
    In this case, we can ask ourselves, which function returns a value? The answer is the last function, the one called getNumberOfPages. The first two functions, printTitle and markAsRead, are functions...