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.

Program - Palindrome check for Number

In Previous post, we discussed about a program to reverse digits of a number, Palindrome check for Number is next in the list.

Palindrome mean reverse and original number should be same. eg: 121, 1221, 34543 etc.

This is quiet easy if you know how to Reverse an Integer/Number.

First reverse the number and then compare both, if same then number is Palindrome otherwise it is not.

Complete program to check if a number is Palindrome or not:

Happy Coding!