Reputation: 33900
While in scala REPL, can I execute external script from file?
I mean literally, load and execute lines of text as if I just typed them in the REPL?
Upvotes: 0
Views: 62
Reputation: 8663
Being in repl you can do :load <filepath>
In response to comment below I did some digging. So indeed, you can use :paste <filepath>
as well. The difference is explained in scala docs here http://docs.scala-lang.org/scala/2.11/
:load can only interpret a file from top to bottom which is for example a problem when there is a reference to a definition that is defined later. :paste is overworked to solve this limitation. It now can not only load a file but also handle it as a single unit.
Upvotes: 2