That was a long chapter. But we've also learned a lot. We finished covering all classical design patterns, including eleven behavioral ones. In Kotlin, functions can be passed to other functions, returned from functions, and assigned to variables. That's what the "functions as first-class citizens" concept is all about. If your class is all about behavior, it often makes sense to replace it with a function. Iterator is yet another operator in the language. Sealed classes help in making when statements exhaustive. The run extension function allows for controlling what will be returned from it. A lambda with a receiver allows more clear syntax in your DSLs. Another keyword, lateinit, tells the compiler to relax a bit in its null safety checks. Use with care! And finally, we covered how to reference an existing method with ::.
In the next chapter, we&apos...