Skip to content

Commit 1f6e104

Browse files
authored
Update variables4.rs
1 parent a22ea1d commit 1f6e104

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

exercises/variables/variables4.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// variables4.rs
2-
//
3-
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
4-
// hint.
5-
6-
71
fn main() {
2+
// 1. 声明可变变量x,绑定初始值3(mut关键字表示变量可修改)
83
let mut x = 3;
4+
// 2. 打印初始值:输出 "Number 3"
95
println!("Number {}", x);
6+
// 3. 修改可变变量x的值为5(只有mut变量才能重新赋值)
107
x = 5; // don't change this line
8+
// 4. 打印修改后的值:输出 "Number 5"
119
println!("Number {}", x);
1210
}

0 commit comments

Comments
 (0)