Kotlin Hello World

Kotlin Hello World

Kotlin Hello World is a simple program where we print "Hello World" to standard output.

In this tutorial, we will write a program to print “Hello World” to output, and detail on the syntax used in the program.

Kotlin Program

fun main(args: Array<String>) {
    println("Hello World!")
}

Output

Hello World!

Details of the above program

fun is the keyword to define a function.

main is the function, which acts as an entry point for program execution.

args: Array<String> are the optional arguments that we can pass to the program from command line.

println is a built-in function that can be used to print a value to standard output.