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?
Thanks,
Cay
请先登录再写评论。
Hello,
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.
It seems that I can use the resN variables:
but res0 above still shows as error – with or without REPL mode