Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear in scala (call cls in scala program running in cmd )

Tags:

windows

scala

cls

In python this works:

 clear = lambda: os.system('cls')
 clear()

How would I do that in scala?

like image 577
Sunny Avatar asked Nov 27 '25 21:11

Sunny


2 Answers

For REPL there is :keybindings, Ctrl + L clears the screen.

like image 96
hellraiser Avatar answered Nov 29 '25 10:11

hellraiser


Using REPL started from a bash shell:

scala> import scala.sys.process._
import scala.sys.process._

scala> def clear() = "clear".!
clear: ()Int

scala> clear()
like image 26
Carl Avatar answered Nov 29 '25 10:11

Carl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!