@@ -33,30 +33,31 @@ However, they can be 'shadowed'. Shadowing means that they are redeclared and th
3333A mutable variable is allowed to change its value by assignment. These are declared using the ` mut ` keyword.
3434
3535```
36- > mut val = 42
36+ > mut val = 42
3737> $val += 27
3838> $val
393969
4040```
4141
4242There are a couple of assignment operators used with mutable variables
4343
44- | Operator | Description |
45- | ----------- | -------------------------------------------------------------------------- |
46- | ` = ` | Assigns a new value to the variable |
47- | ` += ` | Adds a value to the variable and makes the sum its new value |
48- | ` -= ` | Subtracts a value from the variable and makes the difference its new value |
49- | ` *= ` | Multiplies the variable by a value and makes the product its new value |
50- | ` /= ` | Divides the variable by a value and makes the quotient its new value |
51- | ` **= ` | Concatenates the variable with a list making the new list its new value |
44+ | Operator | Description |
45+ | -------- | -------------------------------------------------------------------------- |
46+ | ` = ` | Assigns a new value to the variable |
47+ | ` += ` | Adds a value to the variable and makes the sum its new value |
48+ | ` -= ` | Subtracts a value from the variable and makes the difference its new value |
49+ | ` *= ` | Multiplies the variable by a value and makes the product its new value |
50+ | ` /= ` | Divides the variable by a value and makes the quotient its new value |
51+ | ` **= ` | Concatenates the variable with a list making the new list its new value |
5252
5353> ** Note**
54+ >
5455> 1 . ` += ` , ` -= ` , ` *= ` and ` /= ` are only valid in the contexts where their root operations
55- > are expected to work. For example, ` += ` uses addition, so it can not be used for contexts
56- > where addition would normally fail
56+ > are expected to work. For example, ` += ` uses addition, so it can not be used for contexts
57+ > where addition would normally fail
5758> 2 . ` **= ` requires a variable representing a list ** and** a list argument
5859
59- ###### More on Mutability
60+ ##### More on Mutability
6061
6162Closures and nested ` def ` s cannot capture mutable variables from their environment. For example
6263
0 commit comments