Skip to content

Commit 0fd1eb8

Browse files
authored
Merge pull request #63 from jz0425/master
Update variables.md
2 parents fdaa801 + 63a5a10 commit 0fd1eb8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/variables.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Variables
22

3-
A _variable_ is a component of a stack frame, either a named function parameter,
3+
A _variable_ is a component of a stack frame. That component can be a named function parameter,
44
an anonymous [temporary](expressions.html#lvalues-rvalues-and-temporaries), or a named local
55
variable.
66

77
A _local variable_ (or *stack-local* allocation) holds a value directly,
88
allocated within the stack's memory. The value is a part of the stack frame.
99

10-
Local variables are immutable unless declared otherwise like: `let mut x = ...`.
10+
Local variables are immutable unless declared otherwise. For example: `let mut x = ...`.
1111

1212
Function parameters are immutable unless declared with `mut`. The `mut` keyword
13-
applies only to the following parameter (so `|mut x, y|` and `fn f(mut x:
13+
applies only to the following parameter. For example: `|mut x, y|` and `fn f(mut x:
1414
Box<i32>, y: Box<i32>)` declare one mutable variable `x` and one immutable
15-
variable `y`).
15+
variable `y`.
1616

1717
Methods that take either `self` or `Box<Self>` can optionally place them in a
18-
mutable variable by prefixing them with `mut` (similar to regular arguments):
18+
mutable variable by prefixing them with `mut` (similar to regular arguments). For example:
1919

2020
```rust
2121
trait Changer: Sized {
@@ -24,8 +24,8 @@ trait Changer: Sized {
2424
}
2525
```
2626

27-
Local variables are not initialized when allocated; the entire frame worth of
28-
local variables are allocated at once, on frame-entry, in an uninitialized
27+
Local variables are not initialized when allocated. Instead, the entire frame worth of
28+
local variables are allocated, on frame-entry, in an uninitialized
2929
state. Subsequent statements within a function may or may not initialize the
3030
local variables. Local variables can be used only after they have been
3131
initialized; this is enforced by the compiler.

0 commit comments

Comments
 (0)