Wednesday 14 August 2013

Statements and Expressions (via Atomic Scala)

NOTE: I’ve posted on the vague area of this topic before

As previously discussed, not having a strict CompSci background seems to be a particular hindrance when trying to learn Scala. At least when you are following the standard texts. One example of this is around the terminology regarding “Statements” and “Expressions”. I know it’s important I know the difference, but what is  the difference?  “Atomic Scala, Atom: Expressions” (pp. 54) to the rescue:

A statement changes state […] An expression expresses [a] result.

Now, not only is this clear, its terse, and memorable too. I’d expect nothing less from a book co-written by the author of Thinking in Java.  Good ole’ breezy simplicity.  A section of my mind now feels free to really grok the goodness of immutability and case classes.

No comments:

Post a Comment