Sharing our technical trials in terms of Ubuntu software installs, Blogger hacks, Android and Kotlin learning.
How to use REPL feature in IntelliJ IDEA
How to use REPL feature in IntelliJ IDEA

How to use REPL feature in IntelliJ IDEA

The post briefs on REPL feature in IntelliJ IDEA and how to use it.

Using REPL feature in IntelliJ IDEA you can try out a piece of code on the fly outside the main code. REPL – stands for Read-Eval-Print Loop.

To open this option in the IDE choose,

Tools – > Kotlin – > Kotlin REPL – it opens a new window at the bottom of the screen.

finding repl option on IntelliJ IDE

Now to use REPL, type the code you want to try out in the section showing the hint <CTRL+ENTER> to execute

REPL window

And then click on the green Run button to execute, after a pause you should be able to see the output.

REPL window with successful execution

While executing if your piece of code has error it will be shown in the REPL window

REPL window with execution error

For example:

Print statement is written as println(“Hello World”) we wrote it as printl(“Hello World”), hence there is an error shown in the REPL window.

Now that you know how to use REPL feature on IntelliJ IDEA you can try out the code outside main code to be sure and then go for adding it in your main code.

For more post’s on Kotlin check out our Kotlin-Hacks section.

You can also checkout the YouTube video on the same