mirror of https://github.com/KaiserY/trpl-zh-cn
Signed-off-by: Sefank <12670778+Sefank@users.noreply.github.com>pull/624/head
parent
860f99a134
commit
7090f728ec
@ -1,6 +1,6 @@
|
||||
fn main() {
|
||||
let x = 5;
|
||||
println!("The value of x is: {}", x);
|
||||
println!("The value of x is: {x}");
|
||||
x = 6;
|
||||
println!("The value of x is: {}", x);
|
||||
println!("The value of x is: {x}");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn main() {
|
||||
let mut x = 5;
|
||||
println!("The value of x is: {}", x);
|
||||
println!("The value of x is: {x}");
|
||||
x = 6;
|
||||
println!("The value of x is: {}", x);
|
||||
println!("The value of x is: {x}");
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
fn main() {
|
||||
// 加法
|
||||
// addition
|
||||
let sum = 5 + 10;
|
||||
|
||||
// 减法
|
||||
// subtraction
|
||||
let difference = 95.5 - 4.3;
|
||||
|
||||
// 乘法
|
||||
// multiplication
|
||||
let product = 4 * 30;
|
||||
|
||||
// 除法
|
||||
// division
|
||||
let quotient = 56.7 / 32.2;
|
||||
let floored = 2 / 3; // 结果为 0
|
||||
let floored = 2 / 3; // Results in 0
|
||||
|
||||
// 取余
|
||||
// remainder
|
||||
let remainder = 43 % 5;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
let t = true;
|
||||
|
||||
let f: bool = false; // 显式指定类型注解
|
||||
let f: bool = false; // with explicit type annotation
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn main() {
|
||||
for number in (1..4).rev() {
|
||||
println!("{}!", number);
|
||||
println!("{number}!");
|
||||
}
|
||||
println!("LIFTOFF!!!");
|
||||
}
|
||||
|
Loading…
Reference in new issue