Latest Posts

Learn Kotlin using Kotlin Koans & REPL(Read, Eval, Print, Loop)

Kotlin’s popularity continues to grow, and there’s never been a better time to start using & learning the language. Thankfully, Kotlin is surprisingly easy to try out. You can try it in a browser. It’s supported my multiple IDEs. You can learn on your own in a new project, or walk through sample exercises with a guided learning plugin. This posts collects a number of those resources so you can pick what works best for you.

Scratches let us create code drafts in the same IDE window as our project and run them on the fly. Scratches are not tied to projects; you can access and run all your scratches from any IntelliJ IDEA window on your OS. To create a Kotlin scratch, click File | New | Scratch file and select the Kotlin type.

In turn, worksheets are project files: they are stored in project directories and tied to the project modules. Worksheets are useful for writing code parts that don’t actually make a software unit but should still be stored together in a project. For example, you can use worksheets for education or demo materials.

To create a Kotlin worksheet in a project directory, right-click the directory in the project tree and select New | Kotlin Worksheet.

In scratches and worksheets, you can write any valid Kotlin code. Syntax highlighting, auto-completion, and the other IntelliJ IDEA code editing features are all supported too. Note that there’s no need for declaring the main function: all the code you write is executed as if it would be in the body of main.

Once you have finished writing your code in a scratch or a worksheet, click Run. The execution results will appear in the lines opposite your code.

Latest Posts

Don't Miss