Kotlin Introduction
Kotlin is a programming language. People use it for Android apps and for programs on a computer.
A greeting on screen
This short program shows one greeting. The greeting is the whole output.
fun main() {
println("Hello from Kotlin")
}Two lines in order
The first println runs before the second println. Each line appears below the one before it.
fun main() {
println("First line")
println("Second line")
}A number on screen
println can also show a number by itself. This program shows the number 3.
fun main() {
println(3)
}Example
fun main() {
println("Welcome")
println("Kotlin")
println(1)
}Key points
- Kotlin code in this course runs as plain programs on a computer.
- Use println to put a value on the screen.
- A text value in code sits inside double quotes.
In this example, the first println shows Welcome. The second println shows Kotlin below it. The third println shows the number 1 below Kotlin.
Try it Yourself
Edit the code, then press Run.
Running is simulated Β· Kotlin Playground
Exercise
What is Kotlin?