Clear Scala REPL console


Scala REPL is very power tool. REPL stands for Read Evaluate Print Loop

Initially when I started learning scala, REPL was the first place where I got my hands dirty with Scala.

many times i struggled to clear REPL console, then I have to close the session using quit command.



After some checking on google and scala official page, I found that we can reset it using :reset command, while resetting REPL forgets everything done during current session.

To reset REPL session, run command as below:



It shows everything it clears from session. I was having 2 values a and b. 

This command comes handy when you need to reset your REPL session.

Your First Program in Scala

First Program in Scala

As per convention, the first program we write while start learning a new language is to print "Hello, World!" string.

Here in this post we will see how to print Hello World String.



Save this in a file named HelloWorld.scala

HelloWorld is an singleton class, Singleton classes are declared and instanted in Scala using Object keyword inplace of class.

Compile and run this code by below commands




This will print Hello World! on console.

Happy Learning!