Kotlin Fundamentals
Learn Kotlin, Google's recommended language for Android: variables, null safety, functions, classes, collections and coroutines — with runnable examples in your browser.
4
units
16
lessons
49
practice questions
~240
minutes
Start learning today
Create a free account, then unlock this and every other Pro course with Learnix Pro for KES 999/month.
Create free account I already have an accountOutcomes
What you'll be able to do
Write and run Kotlin programs in the browser
Use val/var, types, when-expressions and loops
Avoid crashes with Kotlin's null safety
Model data with classes, data classes and sealed classes
Transform collections with map, filter and lambdas
Understand coroutines for background work
How it works
Read it, see it, practise it
Each lesson explains one topic clearly, shows worked examples, checks your understanding with quick questions and ends with a practical task you complete yourself.
Clear explanations
Step-by-step lessons in plain language
31 in this course
Worked examples
Real code and examples you can copy and run
32 in this course
Quick checks
Test your understanding as you go
33 in this course
Fill the blank
Recall the key commands and syntax
16 in this course
Hands-on workspace
A practical task at the end of every lesson
16 in this course
Syllabus
Everything you'll encounter
Why Kotlin and Your First Program
Kotlin is the language Google recommends for Android. Meet it, run your first program in the browser and see why developers love how little code it needs.
val, var and Types
Kotlin separates values that never change from ones that do, and figures out most types for you. Learn the core types and safe conversions.
Strings, Templates and Reading Input
Build readable text with string templates, clean and format input, and read what the user types, safely, without crashing on bad input.
if, when and Loops
In Kotlin, if and when are expressions that return values — cleaner than Java's switch. Loop with ranges and collections.
Null Safety: Goodbye NullPointerException
The most common crash in Java apps is calling something on null. Kotlin's type system makes that mistake almost impossible — learn ?, ?., ?: and !!.
Functions, Default Arguments and Lambdas
Write concise functions with default and named arguments, single-expression bodies, extension functions and lambdas — used constantly in Android click handlers.
Extension Functions and Scope Functions
Add your own methods to existing types like String and Int, and use let, apply, also, run and with: the idioms you will see on every line of Android code.
Classes, Data Classes and Objects
Model your app's data. Kotlin gives you primary constructors, properties, data classes with free equals/toString/copy, and singleton objects.
Interfaces, Inheritance and Sealed Classes
Share behaviour with interfaces and open classes, and model screen states safely with sealed classes — a pattern used in almost every modern Android app.
Enums and Generics
Model fixed choices with enum classes, and write classes and functions that work with any type, safely. Both appear constantly in Android state handling.
Collections: List, Map and Powerful Operations
Kotlin's collection functions — map, filter, groupBy, sumOf, sortedBy — turn loops into one readable line. You will use them in every screen that shows a list.
Files and Dates
Keep data after the program closes by reading and writing files, and do date maths (due dates, ages, late fees) correctly with java.time.
Errors and Coroutines
Handle failures with try/catch and runCatching, and meet coroutines — Kotlin's way to do slow work (network, database) without freezing the app.
Flow: Streams of Values Over Time
A suspend function returns one value; a Flow delivers many, over time: live prices, download progress, search results as you type. Flow and StateFlow drive modern Android screens.
Packages, Gradle and Testing
Organise a real project into packages, add libraries with Gradle, and write automated tests with kotlin.test so you can change code without fear.
Mini Project: A Shop Cart in Kotlin
Combine data classes, collections, null safety and errors in one small program — the same model code you will plug into an Android app next.
Finish the course, earn a verifiable certificate
Complete every lesson to receive a Learnix certificate with a unique number anyone can verify online.