Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to quit scala 2.11.0 REPL?

In the last version of scala (2.10.3) REPL, I can type exit to quit from REPL. However, in Scala 2.11.0 this doesn't work.

$ scala
Welcome to Scala version 2.11.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.

scala> exit
<console>:8: error: not found: value exit
              exit
              ^

scala>
like image 730
Billz Avatar asked Oct 17 '22 20:10

Billz


People also ask

How do I end a program in scala?

use std::process::exit; exit(0);

How do I exit scala in spark?

For spark-shell use :quit and from pyspark use quit() to exit from the shell. Alternatively, both also support Ctrl+z to exit.

How do I start scala REPL?

We can start Scala REPL by typing scala command in console/terminal.


1 Answers

I ran into the same issue on upgrade, just use colon q.

:q

Additionally, exit was deprecated in 2.10.x with sys.exit suggested instead, so this works as well:

sys.exit

As a side note, I think they did this so you can distinguish between exiting the scala console in sbt and exiting sbt itself, though I could be wrong.

like image 262
Noah Avatar answered Oct 19 '22 08:10

Noah