]> git.proxmox.com Git - rustc.git/blame - src/doc/book/redirects/mutability.md
New upstream version 1.25.0+dfsg1
[rustc.git] / src / doc / book / redirects / mutability.md
CommitLineData
2c00a5a8 1% Mutability
cc61c64b 2
2c00a5a8 3<small>There is a new edition of the book and this is an old link.</small>
cc61c64b 4
2c00a5a8 5> Variables are immutable only by default; we can make them mutable by adding mut in front of the variable name.
cc61c64b 6
2c00a5a8
XL
7```rust
8let mut x = 5;
9println!("The value of x is: {}", x);
10x = 6;
11println!("The value of x is: {}", x);
12```
13
14---
15
16Here are the relevant sections in the new and old books:
17
18* **[In the second edition: Ch 3.01 — Variables and Mutability][2]**
19* <small>[In the first edition: Ch 3.11 — Mutability][1]</small>
7cac9316
XL
20
21
22[1]: first-edition/mutability.html
abe05a73 23[2]: second-edition/ch03-01-variables-and-mutability.html