IntelliJ IDEA lets you run Scala Console to quickly evaluate an expression or a code selection.
1.Run Scala Console
Right-click on your Scala object and select Run Scala Console from the drop-down list.
The Scala Conslole window opens.
2.Evaluate Code in Scala Console
You can type an expression in the console and evaluate it. You can also evaluate a code selection by sending it from the editor to the Scala console.
To see the result of the typed expression, pressCtrl+Enter.
To send the code selection to Scala Console, select the code in the editor, pressCtrl+Shift+X (for Windows) orMeta+Shift+X (for Mac).
Alternatively, right-click on the code selection and from the context menu select Send Selection To Scala Console to get the same result.
Now, you can view the selected code and its evaluation in the console.
3.Use Toolbars in Scala Console
You can use Run toolbar and Console toolbar options to rerun, stop, pause, or terminate the Scala console.