Is it possible to register Scala REPL output?

Is there a way to register Scala REPL output in a file?

+5
source share
1 answer

You can import java.util.PrintWriter and have the following code:

val out = new PrintWriter("out.txt")
out.println("output string")
out.flush();
out.close();
+2
source

All Articles