A beginner-friendly introduction to the Kotlin programming language. If you have no programming background, start here β the lessons begin from the very first line of code.
The examples use current Kotlin idioms, English comments, and a Gradle build on Kotlin 2.4.20 (K2 compiler) with JDK 21.
- JDK 21 or newer (the Gradle toolchain can download one automatically)
- No local Gradle install is required; use the wrapper
./gradlew compileKotlin
./gradlew test./gradlew run # Hello World (default)
./gradlew runHelloWorld
./gradlew runVariables
./gradlew runLoops
./gradlew runFunctionsYou can also run any lesson by file name (without .kt):
./gradlew runLesson -Plesson=Variables
./gradlew runLesson -Plesson=WhenOpen the project in IntelliJ IDEA or Android Studio and run the main() function in any lesson file.
All lesson sources and Gradle task names use English identifiers. Sample output may include Turkish place names or phrases for learners.
| Lesson | Source | Gradle task | Topics |
|---|---|---|---|
| Hello World | HelloWorld.kt | runHelloWorld |
Entry point, println / print |
| Variables | Variables.kt | runVariables |
var, val, type inference |
| Data types | DataTypes.kt | runDataTypes |
Numeric types, Char, String, Boolean |
| String | String.kt | runString |
Concatenation, iteration, trim, case, split |
| Type conversions | TypeConversions.kt | runTypeConversions |
toInt, toIntOrNull, explicit casts |
| Loops | Loops.kt | runLoops |
while, for, ranges, break / continue, repeat |
| When | When.kt | runWhen |
when statement and expression, type checks |
| Functions | Functions.kt | runFunctions |
Parameters, defaults, single-expression functions, vararg |
| Map | Map.kt | runMap |
Read-only and mutable maps, keys and values |
| Arrays | Arrays.kt | runArrays |
arrayOf, IntArray, indices |
| Lists / ArrayList | ArrayList.kt | runArrayList |
listOf, mutableListOf, list operations |
| Set | Set.kt | runSet |
setOf, uniqueness, set statistics |
| HashSet | HashSet.kt | runHashSet |
hashSetOf, set algebra |
- Open source β compiler, IDE plugins, and build tools are open source.
- Interoperable β designed to work with Java and Android codebases.
- Concise β less boilerplate than Java for the same ideas.
- Tool-friendly β developed by JetBrains (IntelliJ IDEA, Android Studio).
- Null safety β the type system helps you avoid null-pointer mistakes.
- Multiplatform β share logic across Android, iOS, server, desktop, and web targets.
- Modern toolchain β Kotlin 2.x uses the stable K2 compiler by default.
src/main/kotlin/ Lesson sources (one file per topic)
src/test/kotlin/ Smoke tests for selected lessons
gradle/ Version catalog and wrapper
- Getting started with Kotlin
- Kotlin documentation
- Android Kotlin guides
- Kotlin Playground
- What's new in Kotlin 2.4.20
If this project helps you, you can buy me a coffee.
This project is licensed under the MIT License.