res variables in Scala worksheet?

When I type into a Scala worksheet an expression, say,

8 * 5 + 2

the right hand side shows

res0: Int = 42

But then when I type in res0, I get an error. What gives? Does the worksheet not know about the res variables? If not, why are you displaying them in the right hand side?



Comment actions Permalink

these 'resN' at the right side added to make output look similar to scala repl output. Technically, there is no this output when worksheet is being written as the whole worksheet file is recompiled and there is no variables to refer.

Comment actions Permalink

It seems that I can use the resN variables:

but res0 above still shows as error – with or without REPL mode



Please sign in to leave a comment.