Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>IntelliJ IDEA:</strong></p> <ol> <li>Run in debug mode or attach a remote debugger</li> <li>Set a breakpoint and run until you reach it</li> <li>Open <code>Evaluate Expression</code> (<kbd>Alt</kbd>+<kbd>F8</kbd>, in menu: Run -> Evaluate Expression) window to run arbitrary Scala code.</li> <li>Type what code fragment or expression you want to run and click on Evaluate</li> <li>Type <kbd>Alt</kbd>+<kbd>V</kbd> or click on Evaluate to run the code fragment.</li> </ol> <p><img src="https://i.imgur.com/0A4n4fg.png" alt=""></p> <p><strong>Eclipse:</strong></p> <p>As of Scala 2.10 both <code>break</code> and <code>breakIf</code> have been removed from <code>ILoop</code>.</p> <p>To break into interpreter you will have to work with <code>ILoop</code> directly.</p> <p>First add <code>scala compiler</code> library. For Eclipse Scala, right click on project => <code>Build Path</code> => <code>Add Libraries...</code> => <code>Scala Compiler</code>.</p> <p>And then you can use the following where you want to start the interpreter:</p> <pre><code>import scala.tools.nsc.interpreter.ILoop import scala.tools.nsc.interpreter.SimpleReader import scala.tools.nsc.Settings val repl = new ILoop repl.settings = new Settings repl.settings.Yreplsync.value = true repl.in = SimpleReader() repl.createInterpreter() // bind any local variables that you want to have access to repl.intp.bind("row", "Int", row) repl.intp.bind("col", "Int", col) // start the interpreter and then close it after you :quit repl.loop() repl.closeInterpreter() </code></pre> <p>In Eclipse Scala the interpreter can be used from the <code>Console</code> view:</p> <p><img src="https://i.imgur.com/ssG7bLi.png" alt=""></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload