Types, variables, expressions, control flow, equality, and smart casts
This chapter is split into short pages. Read them in order the first time; later, use each page as a quick reference.
Simple way to think about it
A type tells Kotlin what kind of value it is handling. A variable gives that value a name. Control flow decides which code runs. After a successful type check, a smart cast lets you use the value as the checked type without writing a manual cast.
Chapter pages
- Types and variables —
val,var, inferred types, numbers, conversions, and immutability. - Expressions and control flow —
if,when, loops, ranges, and handling every state. - Equality — value comparison, object identity, Compose, lists, and tests.
- Type checks and smart casts —
is,!is,as,as?, and why some smart casts fail. - Android application and interview preparation — a complete UI-state example, mistakes, interview questions, exercises, and revision checklist.
Use Next at the bottom of each page to continue.