Files
learn-rust/function/src/main.rs
T

30 lines
454 B
Rust

fn main() {
println!("Hello, world!");
let y = {
let x = 3;
x + 1
};
println!("The value of y is: {y}");
another_function(32, 'a');
let z = five();
println!("the value of z is {z}");
let x = plus_one(5);
println!("the value of x is {x}")
}
fn another_function(a: usize, b: char) {
println!("Another function. {a}, {b}");
}
fn five() -> i32 {
5
}
fn plus_one(x: i32) -> i32 {
x + 1
}