Search⌘ K
AI Features

First Program in Kotlin

Explore how to write your first Kotlin program with the classic Hello World example. Understand the structure of the main function, how to print output, and how Kotlin handles command-line arguments. This lesson helps you build foundational skills for Kotlin programming.

The Hello, World program

The first step in our Kotlin adventure is to write a minimal program in this language. Yes, it’s the famous Hello, World program. This is what it looks like in Kotlin:

Kotlin 1.5
fun main() {
println("Hello, World")
}
  • Line 1: We define the main function of the Kotlin program with fun ...