注意区别语句和表达式哟。
Rust是一门基于表示式的语言,牢记!!!
fn main() {
println!("Hello world!");
another_function(5, 6);
let y = {
let x = 3;
x + 1
};
println!("The value of y is: {}", y);
let x = plus_one(5);
println!("The value of x is: {}", x);
}
fn another_function(x: i32, y: i32) {
println!("The value of x is: {}", x);
println!("The value of y is: {}", y);
}
fn plus_one(x: i32) -> i32 {
x + 1
}
转载于:https://www.cnblogs.com/aguncn/p/11379646.html
相关资源:JAVA上百实例源码以及开源项目