fun main() { println("Hello, World!") }
- An entry point to a Kotlin application is the main function. In Kotlin 1.3, you can declare main without any parameters. The return type is not specified, which means that the function returns nothing.
- println writes a line to the standard output. It is imported implicitly. Also note that semicolons are optional.
In Kotlin versions earlier than 1.3, the main function must have a parameter of type Array<String>.
fun main(args: Array<String>) { println("Hello, World!") }