Browse Source

Merge pull request #26 from K-Guan/patch-2

Fixed the incorrect part in "Associativity"
Swaroop C H 9 years ago
parent
commit
bbdeee5bae
1 changed files with 12 additions and 3 deletions
  1. 12 3
      op_exp.asciidoc

+ 12 - 3
op_exp.asciidoc

@@ -227,9 +227,18 @@ expression, then you can write something like `(2 + 3) * 4`.
 === Associativity
 
 Operators are usually associated from left to right. This means that operators with the same
-precedence are evaluated in a left to right manner. For example, `2 + 3 + 4` is evaluated as `(2 +
-3) + 4`. Some operators like assignment operators have right to left associativity i.e. `a = b = c`
-is treated as `a = (b = c)`.
+precedence are evaluated in a left to right manner. For example, `2 + 3 + 4` is evaluated as `(2 + 3) + 4`. 
+
+Assignment operators are the same. For example, `a = b = c` is treated as: 
+
+[source,python]
+--------------------------------------------------
+temp = c
+a = temp
+b = temp
+--------------------------------------------------
+
+In this case `temp` is a temporary variable, actually it does not exist, or we can say it will be deleted then.
 
 === Expressions