# Kotlin Essentials

> The Kotlin language for Android: null safety, data classes, lambdas, collections and coroutines basics. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/mobile/kotlin
Last updated: 2026-11-28

The Kotlin language for Android: null safety, data classes, lambdas, collections and coroutines basics.

Beginner · about 10 hours · difficulty 2/5

If you chose native Android, Kotlin is the official language. It is concise, null-safe and interoperable with Java libraries.

### What to learn

- **val vs var**: prefer immutable `val`.
- **Null safety**: `String` vs `String?`, safe calls `?.`, the Elvis operator `?:`, and why `!!` is a smell.
- **Functions**: default and named arguments, single-expression functions, extension functions.
- **Classes**: `data class` for models, `sealed class`/`sealed interface` for UI states, `object` for singletons.
- **Lambdas and collections**: `map`, `filter`, `groupBy`, trailing lambda syntax (Compose relies on it heavily).
- **when** expressions for exhaustive branching over sealed types.

### Coroutines preview

Coroutines let you write asynchronous code sequentially using `suspend` functions. On Android you launch them in a lifecycle-aware scope like `viewModelScope`. You will go deeper in the Android section.

### Pitfalls

Java habits (getters/setters, nullable everything, mutable lists) make Kotlin code verbose and fragile. Lean on the idioms.

**Good enough to move on:** you can model a screen's state with a sealed interface and handle every case with `when`.

## Key concepts

- **val, var and type inference**
- **Null safety operators**
- **Data classes and sealed types**
- **Lambdas and trailing lambda syntax**
- **Collection operations**
- **Extension functions**
- **Coroutines and suspend functions**

## Mini project

Write a Kotlin console program that models a shopping cart with data classes and prints a receipt grouped by category.

## Check yourself

Why is a sealed interface a better way to represent Loading, Success and Error states than three nullable fields?

## Free resources

- [Kotlin documentation](https://kotlinlang.org/docs/home.html) (JetBrains)
- [Kotlin coroutines guide](https://kotlinlang.org/docs/coroutines-overview.html) (JetBrains)

Previous: [Dart Essentials](https://www.internhack.in/roadmaps/tracks/mobile/dart) · Next: [Swift Essentials](https://www.internhack.in/roadmaps/tracks/mobile/swift)

## More in Language Foundations

- [JavaScript Essentials](https://www.internhack.in/roadmaps/tracks/mobile/javascript-basics)
- [TypeScript for App Code](https://www.internhack.in/roadmaps/tracks/mobile/typescript)
- [Dart Essentials](https://www.internhack.in/roadmaps/tracks/mobile/dart)
- [Kotlin Essentials](https://www.internhack.in/roadmaps/tracks/mobile/kotlin)
- [Swift Essentials](https://www.internhack.in/roadmaps/tracks/mobile/swift)
- [Async Code & the Main Thread](https://www.internhack.in/roadmaps/tracks/mobile/async-programming)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Mobile App Developer Roadmap](https://www.internhack.in/roadmaps/tracks/mobile)
