Kt Course · 67 lessons · approx. 427 minutes

Learn Kotlin

Learn Kotlin step by step: output, variables, decisions, lists, functions and null safety. Guided coding tasks check your solution; you start free programs in the online compiler.

  • println
  • val & var
  • Types
  • String templates
  • if & when
  • Listen & Schleifen
  • Functions
  • Null safety
  • data class
  • map: calculating a new list
  • Map: finding values by name
  • ?.let: using an existing value
  • filter: selecting matching minutes
  • sum: adding up a list of numbers
  • Destructuring a data class
  • An extension function for a number
  • class: objects with state
  • sealed class: all cases known
  • Default values and named arguments
  • groupBy: sorting elements into groups
  • sortedBy: ordering by a property
  • Expressing preconditions with require
  • Using an existing value with let
  • Removing null values from a collection
  • Collecting records under a key
  • Building up a result with fold
  • Changing data class values with copy
  • when as the result of a decision
  • Calculating a local result with run
  • Texts and collections
  • Functions in depth
  • Objects in depth
  • data class and sealed class
  • Processing collections

What you’ll learn

  1. Chapter 1First lines – Print, remember, calculate – no prior knowledge needed.
    Hallo, Kotlin! · Remembering values: val and var · Data types · Text with placeholders
  2. Chapter 2Decisions – if, else and when.
    If … otherwise: if and else · if as a value · Many cases: when
  3. Chapter 3Lists and loops – Many values, one loop.
    Lists with listOf · Every element: for · Number ranges: 1..5 · Changeable lists
  4. Chapter 4Functions – Build your own commands.
    A function of your own · Returning values
  5. Chapter 5Safe and structured – Null safety and data classes.
    Null safety · Bundling data: data class
  6. Chapter 6Workshop: like in a real app – Process lists and build small programs.
    Filtering and transforming lists · Mini project: XP analysis
  7. Chapter 7New tools for your own ideas – Understand new concepts, fill them in and use them yourself.
    map: calculating a new list · Map: finding values by name · ?.let: using an existing value
  8. Chapter 8Level up: your next practice chapter – Understand four new building blocks in small steps and use them yourself.
    filter: selecting matching minutes · sum: adding up a list of numbers · Destructuring a data class · An extension function for a number
  9. Chapter 9Master chapter: how real programs are built – Five building blocks from real projects – explained, connected, filled in and written by you.
    class: objects with state · sealed class: all cases known · Default values and named arguments · groupBy: sorting elements into groups · sortedBy: ordering by a property
  10. Chapter 10Project tools: understand and apply – Eight more building blocks with explanation pages and four exercises per lesson.
    Expressing preconditions with require · Using an existing value with let · Removing null values from a collection · Collecting records under a key · Building up a result with fold · Changing data class values with copy · when as the result of a decision · Calculating a local result with run
  11. Chapter 11Texts and collections – Text functions, joinToString, sets, buildString and a word counter.
    uppercase, startsWith and reversed · joinToString: lists as text · distinct and Set · buildString: putting texts together · Boss: count words
  12. Chapter 12Functions in depth – Functions as values, vararg, apply and also, function references.
    Functions as parameters · vararg: any number of arguments · apply and also · Function references with :: · Boss: a flexible rating
  13. Chapter 13Objects in depth – Interfaces with default methods, abstract and open, companion object, enum class and an account.
    interface with a default method · abstract, open and super · companion object and object · enum class with properties · Boss: a safe account
  14. Chapter 14Null safety – Types with ?, safe calls with ?., fallbacks with ?:, let and safe casts with as?.
    May it be null? String and String? · Fallbacks: the Elvis operator ?: · Only when there is a value: ?.let · Converting safely: as? and is · Boss: validating a form
  15. Chapter 15data class and sealed class – Data classes with toString, equals and copy, destructuring, sealed classes and when without else.
    Data without effort: data class · Changing without changing: copy · Destructuring: val (a, b) = … · A closed choice: sealed class and when · Boss: orders with states
  16. Chapter 16Processing collections – filter and map, sortedBy, groupBy, associate and fold – data analysis in a few lines.
    Selecting and transforming: filter and map · Sorting by fields: sortedBy · Grouping: groupBy · Summarising: sumOf and fold · Boss: a course evaluation

Final project: Kotlin learning companion

A small program with learning goals, a list and an evaluation.

How it works

Every lesson starts with short explanation pages. Then you practise with multiple-choice questions, fill-in-the-gap tasks, putting code in order and writing your own code – with hints and instant feedback. Free, without ads, on phone, tablet and PC.

Learn Kotlin now