Skip to content

Instantly share code, notes, and snippets.

@ketankhairnar
Created July 31, 2013 18:23
Show Gist options
  • Save ketankhairnar/6124687 to your computer and use it in GitHub Desktop.
Save ketankhairnar/6124687 to your computer and use it in GitHub Desktop.
scala by Example
chapter 4: Expressions and Simple functions
===========================================================================================================================
There are 2 types of expressions.
1. def x = 5
2. val x = 5
Here # 1 represens definition and expression is at the right hand side of the = sign. It is not evaluated immediately.
Here # 2 represents value expression and its value is evaluated immediately and whenver val is being used; it replaces
it with pre-computed value of expression.
===========================================================================================================================
Expression Evaluation:
Expressions have operators and they are evaluated in below order
1. pick the left most operator
2. evaluate its operands
3. apply the operator on operand values
===========================================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment