Kotlin Programming Cookbook
上QQ阅读APP看书,第一时间看更新

There's more...

Kotlin can also be used for writing shell scripts. A shell script has top-level executable code.

Kotlin script files have the .kts extension as opposed to the usual .kt for Kotlin applications.

To run a script file, just pass the -script option to the compiler:

$ kotlinc -script kotlin_script_file_example.kts