September 2019
Intermediate to advanced
462 pages
11h 3m
English
Let’s first create a small Hello World program in Kotlin. Using your favorite text editor create a file named Hello.kt, like so:
| | fun main() = println("Hello World") |
Don’t worry about the syntax in the code at this time; let’s keep our focus on getting the code to run. We’ll discuss the language syntax and semantics in following chapters. You may specify the parameter for the main() function if you like, but starting with Kotlin 1.3, it’s optional. If you’re using a version prior to 1.3, then you’ll need to add the parameter, like so: fun main(args: Array<String>).
To compile and run the code from the command line, first execute the following command:
| | $ kotlinc-jvm ... |
Read now
Unlock full access