Chapter 1. Kotlin: what and why
Listing 1.1. An early taste of Kotlin
Chapter 2. Kotlin basics
Listing 2.1. “Hello World!” in Kotlin
Listing 2.2. Using string templates
Listing 2.3. Simple Java class Person
Listing 2.4. Person class converted to Kotlin
Listing 2.5. Declaring a mutable property in a class
Listing 2.6. Using the Person class from Java
Listing 2.7. Using the Person class from Kotlin
Listing 2.8. Putting a class and a function declaration in a package
Listing 2.9. Importing the function from another package
Listing 2.10. Declaring a simple enum class
Listing 2.11. Declaring an enum class with properties
Listing 2.12. Using when for choosing the right enum value
Listing 2.13. Combining options in one when branch
Listing 2.14. Importing enum constants to access without qualifier
Listing 2.15. Using different objects in when branches
Listing 2.16. when without an argument
Listing 2.17. Expression class hierarchy
Listing 2.18. Evaluating expressions with an if-cascade
Listing 2.19. Using if-expressions that return values
Listing 2.20. Using when instead of if-cascade
Listing 2.21. Using when with compound actions in branches
Listing 2.22. Using when to implement the Fizz-Buzz game
Listing 2.23. Iterating over a range with a step
Listing 2.24. Initializing and iterating over a map
Listing 2.25. Checking range membership using in
Listing 2.26. Using in checks as when branches
Listing 2.27. Using try as in Java
Listing 2.28. Using try as an expression