You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/src/basics/variables.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ let mut foo = 5;
30
30
foo = 6;
31
31
```
32
32
33
-
Now, `foo` is mutable, and the reassignment to the number `6` is valid. That is, we are allowed to _mutate_ the variable `foo` to change its value.
33
+
Now, `foo` is mutable, and the assignment to the number `6` is valid. That is, we are allowed to _mutate_ the variable `foo` to change its value.
34
34
35
35
When assigning to a mutable variable, the right-hand side of the assignment is evaluated before the left-hand side. In the below example, the mutable variable `i` will first be increased and the resulting value of `1` will be stored to `array[1]`, thus resulting in `array` being changed to `[0, 1, 0]`.
Copy file name to clipboardExpand all lines: docs/reference/src/documentation/language/variables/variable-shadowing.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# Shadowing
2
2
3
-
When looking at the [let](let.md) variable we've seen that the value can be changed through the use of the `mut` keyword. We can take this a couple steps further through [reassignment](#reassignment) and [variable shadowing](#variable-shadowing). Note that shadowing applies only to variables. [Constants](const.md) cannot be shadowed.
3
+
When looking at the [let](let.md) variable we've seen that the value can be changed through the use of the `mut` keyword. We can take this a couple steps further through [assignment](#assignment) and [variable shadowing](#variable-shadowing). Note that shadowing applies only to variables. [Constants](const.md) cannot be shadowed.
4
4
5
-
## Reassignment
5
+
## Assignment
6
6
7
7
We can redefine the type and value of a variable by instantiating a new version after the first declaration.
0 commit comments