How to enter multiline commands (statements) into the Scala REPL
Briefly

When you want to test a multiline command/statement in the Scala REPL, you can easily run into a problem where the REPL gets confused, attempting to evaluate prematurely.
A simple way to get around the multiline statement problem is to use the :paste command in the REPL. After entering :paste, the REPL prompts you to paste your command.
After entering my four-line if statement and pressing [Ctrl][D], the REPL exits paste mode and interprets the command, printing the output properly.
In some cases, you can create multiline commands in the Scala REPL without using :paste, just by adding curly braces to your statements.
Read at Alvinalexander
[
]
[
|
]