Stage 1 · Lesson 1 of 9
val, var and type inference
uses : it works out the type for you. So val count = 3 is an Int and can never hold a String. Use val for a name that is assigned once, and var only when you really reassign; most Kotlin code is almost all val.
Learn the basic types: Int, Long, Double, Boolean and String. Kotlin never converts numbers silently. You cannot pass an Int where a Long is expected without calling toLong().
String templates, as in "Hello $name", replace joining strings with +. Note that val fixes only the reference, not the object it points to.
Common trapthinking val means : val items = mutableListOf(1) still lets you call items.add(2).
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeKotlin Documentation
JetBrains
Start with the Kotlin tour, then the null safety and coroutines basics pages
- CourseFreeAndroid Basics with Compose
Google · Beginner
The Kotlin pathways in Units 1 to 3 teach the language with practice sets