Kotlin is a statically-typed programming language that runs on the Java virtual machine and also can be compiled to
JavaScript source code or use the LLVM compiler infrastructure.
Popular Java IDE to run Kotlin is IntelliJ IDEA.
Steps to set up new project in IntelliJ IDEA.
Click Create New Project.
In menu, select Koltin > Kotlin (JVM) and hit Next to work with Kotlin/Java.
Give the name project select location and press finish button, then you are ready to run Kotlin programs.
Like Java package header is optional.
Main fuunction in Kotlin takes an Array of strings as a parameter.
Println is used to print statement as like System.out.println in java
In Kotlin Semicolons are optional, after println there is no semicolon.
1 2 3 4 5 6 7 8 9 | package hello fun main(args : Array<String>) { println("Kotlin - Hello World ") } |
Output:
1 2 3 | Kotlin - Hello World |