Learn Kotlin – all lessons
16 lessons from beginner to advanced, building on each other and with code examples.
Hello World & main
Your first Kotlin program, output, and comments.
Variables, Types & String Templates
val and var, type inference, number types, and text with values.
Conditions: if and when
if as an expression and the powerful when.
Loops & Ranges
for over ranges and collections, while, and breaking out with labels.
Functions
Default values, named arguments, vararg, and returning multiple values.
Lists, Sets & Maps
The basic Kotlin collection types – read-only or mutable.
Null Safety
Nullable types, safe call, Elvis, smart cast, and !!.
Classes, Properties & Interfaces
Primary constructor, properties, inheritance with open, and interfaces.
Data Classes, Enums & Objects
Data classes with copy, enum classes, singletons, and companion objects.
Extension Functions, Lambdas & Scope Functions
Extending existing types and using functions as values.
Collection Operations & Sequences
filter, map, groupBy, fold, and lazy sequences.
Error Handling & Files
try as an expression, require/check, runCatching, and file access.
Sealed Classes, Value Classes & Exhaustive when
Modeling closed hierarchies and type-safe wrappers with no overhead.
Coroutines & Flow
Concurrency with suspend, launch, async, dispatchers, cancellation, and Flow.
Generics, Delegation & DSLs
Variance, reified, delegated properties, class delegation, and builder DSLs.
Gradle, Tests, Java Interop & Multiplatform
Setting up a project, testing, and mixing Kotlin with Java and other platforms.