Add two new assignment operators
This commit is contained in:
		
							parent
							
								
									4c7a23867e
								
							
						
					
					
						commit
						649ff070d8
					
				
							
								
								
									
										19
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								README.md
									
									
									
									
									
								
							| @ -140,6 +140,25 @@ For example: | ||||
| 
 | ||||
| If you however try to use these kinds of assignment operators on variabes which have not been initialized with a value yet, an exception will occur. | ||||
| 
 | ||||
| There are also two kinds of "special" assignment operators: | ||||
| - `++` increment unary operator functions like `+= 1` | ||||
| - `--` decrement unary operator functions like `-= 1` | ||||
| 
 | ||||
| for example: | ||||
| ``` | ||||
| let i = 0; | ||||
| let first = i++; // first becomes 0, i increments to 1 | ||||
| let second = i--; // second becomes 1, i decrements back to 0. | ||||
| ``` | ||||
| 
 | ||||
| All assignment operators return the value the assignee (leftside of the operator) was before the operator. For more examples: | ||||
| 
 | ||||
| ``` | ||||
| let test = 0; | ||||
| let new = (test = 2); // new becomes 0, test becomes 2 | ||||
| let another = (new += 5); /// another becomes 0, new becomes 5. | ||||
| ``` | ||||
| 
 | ||||
| ## Scopes | ||||
| Scopes are areas of code surrounded by brackets `{}`. E.g. | ||||
| ``` | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Teascade
						Teascade