In IntelliJ IDEA scala, a worksheet handles values ββinside objects differently than Eclipse / Scala.
Values ββinside objects are not evaluated in linear sequence mode; instead, they are treated like a regular scala object. You almost do not see information about this until explicit use.
To see your val and expressions, simply define or evaluate them outside of any \ class object
In some cases, this can be a savior. Suppose you have these definitions.
val primes = 2l
Note that isPrime may be a simple def , but for some reason we decided to define it as val .
Such code is good and works in any normal scala code, but will not work on the worksheet, because val definitions are cross-references.
But it wraps such lines inside some object, for example
object Primes { val primes = 2l
It will be evaluated without problems.
source share