We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f6e104 commit 2d3bf46Copy full SHA for 2d3bf46
exercises/variables/variables5.rs
@@ -1,12 +1,11 @@
1
-// variables5.rs
2
-//
3
-// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
4
-// hint.
5
-
6
7
fn main() {
+ // 1. 声明变量number,绑定字符串值"T-H-R-E-E"(类型:&str)
8
let number = "T-H-R-E-E"; // don't change this line
+ // 2. 打印字符串:输出 "Spell a Number : T-H-R-E-E"
9
println!("Spell a Number : {}", number);
+
+ // 3. 变量遮蔽:用let重新声明同名变量number,绑定整数值3(类型:i32)
10
let number = 3; // don't rename this variable
+ // 4. 打印计算结果:3 + 2 = 5,输出 "Number plus two is : 5"
11
println!("Number plus two is : {}", number + 2);
12
}
0 commit comments