Skip to content

Kotlin Programming Textbook

A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 170 companion flashcards using spaced repetition.

7 chapters · 170 cards · Updated

Chapters

  1. 1Foundations — Types, Variables, and Expressions

    Kotlin's type system starts with two declarations that differ only in mutability: val creates a read-only reference that cannot be reassigned, while var creates a mutable one. Beyo...

  2. 2Null Safety

    Null safety is Kotlin's most celebrated feature, designed to eliminate NullPointerException at compile time. By default, types are non-nullable — declaring var name: String means t...

  3. 3Classes, Objects, and Inheritance

    Kotlin classes are final by default, meaning they cannot be inherited unless explicitly marked open. An open class can be extended, and its members can be overridden with the overr...

  4. 4Functions, Lambdas, and Scope Functions

    Functions are first-class citizens in Kotlin. A higher-order function is one that takes a function as a parameter or returns one, opening up powerful composition patterns. The func...

  5. 5Properties and Delegation

    Kotlin's property model unifies simple field access with getter and setter logic. A declaration like val name: String creates a property that the compiler backs with a private fiel...

  6. 6Collections, Sequences, and Strings

    Kotlin's collection library distinguishes read-only interfaces from their mutable counterparts. List, Set, and Map describe immutable collections, while MutableList, MutableSet, an...

  7. 7Coroutines and Flow

    Coroutines are Kotlin's framework for writing asynchronous code that looks synchronous. A coroutine is a lightweight, cooperatively scheduled unit of work that can be paused and re...

← Back to the Kotlin Programming deck