Type the following:
scala> 1 + 1
res0: Int = 2
scala> 2 * 2
res1: Int = 4
scala> 4 / 2
res2: Int = 2
These snippets are executed interactively. Notice the feedback the interpreter gives res0, res1 and res2. This means the result of the expression are stored in them along with their types, in this case Int. For example, we can do the following too:
scala> 2 * res0
res3: Int = 4
No comments:
Post a Comment