You want to run Kotlin in an interactive shell as a quick and easy way to evaluate Kotlin expressions without starting up a full integrated development environment (IDE).
Use the Kotlin REPL by typing
kotlinc at the command line.
Kotlin includes an interactive compiler session, known as a REPL (Read-Eval-Print-Loop) that is triggered by the
kotlinc command with no arguments. Once inside the REPL, you can evaluate arbitrary Kotlin commands and see the results immediately.
TIP: The Kotlin REPL is also available inside Android Studio and IntelliJ IDEA as the
Kotlin REPL entry under the
After running the
kotlinc command, you will receive an interactive prompt.
Once you're logged in, try a command:
You can also do things like set variables:
var name = "Dolly" println("Hello, $name!")
Finally, you can get help:
When you're done, use the
Oh -- I need this as the base image:
docker pull zenika/kotlin