Variables & Data Types
Learn how to declare variables with val and var, understand Kotlin's basic types (Int, String, Boolean, Double), and write your first Kotlin program.
Welcome to Kotlin
Kotlin is the official language for Android development, created by JetBrains and backed by Google.
- Concise: less boilerplate than Java
- Safe: null safety built in
- 100% interoperable with Java
Every Android app you write today starts with Kotlin.
val vs var
Kotlin has two ways to declare a variable:
val— immutable (read-only). Use this by default.var— mutable (can be reassigned).
Prefer val whenever possible — it prevents accidental changes.
All lessons in this course
- Variables & Data Types
- Functions & Lambdas
- Control Flow