Kotlin from Zero
Values, types, decisions, loops, functions, collections, null safety, classes, lambdas and a gentle first look at coroutines. Every idea is anchored by a tiny program you actually run.
val and var — names for things
Programs are mostly about giving names to values. Kotlin makes you say, every single time, whether that name is allowed to change — and that one small decision prevents a surprising number of bugs.
1.2Types: Int, Double, Boolean, String
Every value in Kotlin has a kind — whole number, decimal, yes/no, or text. Kotlin tracks that kind for you and refuses to build code that mixes them up, which turns a whole family of crashes into a red underline you fix in seconds.
1.3Strings, templates and escaping
Almost everything a user reads is a String you built. Learn to slot values into text with templates, to get quote marks and new lines inside a quoted string, and to stop guessing about backslashes.
1.4Math, operators and integer division
Kotlin's arithmetic looks exactly like school maths until one rule bites: dividing two whole numbers throws the fraction away. Learn the operators, the order they run in, and the trap that has bitten every programmer alive.
1.5if / else — making decisions
Until now your programs have run straight down the page. `if` is where they start to choose — checking a condition and taking one path or the other. It is also, in Kotlin, something that can hand back a value.
1.6when — the clean multi-way choice
Five outcomes written as `else if` is a wall of repetition that hides its own bugs. Kotlin's `when` says the thing being tested once, lists the answers underneath, and hands back a value if you want one.
1.7Loops — while, for and ranges
Computers are astonishingly good at doing the same thing again. Learn `while` for "keep going until", `for` for "do this to each of these", and the two-dot-versus-until difference that causes more bugs than anything else in this part.
1.8Functions — naming a recipe
A function gives a name to a block of steps so you can run it whenever you like, from anywhere, without writing it out again. Everything you build from Part 3 onwards is functions calling functions.
1.9Parameters, defaults and named arguments
Give a parameter a default and callers can leave it out. Name your arguments at the call site and the code says what it means. Together these two features replace whole families of near-identical functions.
1.10Lists
One name for many values, kept in order. Learn to build a list, reach into it by position, walk through it with a loop, and understand why counting starts at zero — plus the crash that catches everyone the first time.
1.11Maps and Sets
A list keeps things in order. A map looks things up by name, and a set refuses duplicates. After this you will know which of the three to reach for, and how to walk through a map's entries.
1.12Collection superpowers: filter, map, sumOf
Kotlin can do in one line what a loop takes six lines to say — keep the items you want, change every item, and total them up. After this you will describe what you want instead of spelling out how to get it.
1.13Null safety — the billion-dollar mistake
Null is how code says "there is nothing here". Used carelessly it is the single most common crash in software history. Kotlin makes it a compile-time question instead of a 3 a.m. bug report — this lesson shows exactly how.
1.14Classes and objects
Real apps deal in things — a player, a note, a timer session — not loose values. A class is the blueprint for one kind of thing, describing what it knows and what it can do.
1.15Data classes
One extra word in front of `class` gives you readable printing, comparison by contents, and a free copy function. It is the class you will write most often in this course.
1.16Enums and sealed classes
Some things can only be one of a few options. Enums and sealed classes let you say so — and then the compiler refuses to build your app until you have handled every single one.
1.17Lambdas and higher-order functions
In Kotlin a function is a value you can store, pass around and hand to something else. This is what those braces you have been giving to filter really are — and it is how every button in Part 3 works.
1.18Extension functions and scope functions
Add your own functions to types you did not write, so they can be called with a dot as if they had always been there — then meet the five little scope functions that appear in every Android codebase.
1.19Coroutines, gently
Some work takes time, and doing it in the wrong place freezes the screen. This lesson explains why apps go numb, and introduces the three words — suspend, launch and delay — that let work pause without anything freezing.