Created
July 31, 2013 18:23
-
-
Save ketankhairnar/6124687 to your computer and use it in GitHub Desktop.
scala by Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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