You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
444 B
26 lines
444 B
fn main() {
|
|
|
|
let y = {
|
|
let x = 3;
|
|
x + 1
|
|
};
|
|
|
|
println!("The value of y is: {y}");
|
|
println!("");
|
|
another_function(5);
|
|
|
|
let t = plus_one(5);
|
|
|
|
println!("The value of x is: {t}");
|
|
}
|
|
|
|
fn another_function(x: i32) {
|
|
println!("The value of x is: {x}");
|
|
println!("");
|
|
}
|
|
|
|
fn plus_one(x: i32) -> i32 {
|
|
//not semicolon ; an the end fo the return value.
|
|
x + 1 // ; no semicolon as return value
|
|
}
|