diff --git a/another_function/Cargo.toml b/another_function/Cargo.toml new file mode 100644 index 0000000..e01bde8 --- /dev/null +++ b/another_function/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "another_function" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/another_function/src/main.rs b/another_function/src/main.rs new file mode 100644 index 0000000..b276aec --- /dev/null +++ b/another_function/src/main.rs @@ -0,0 +1,23 @@ +fn main() { + println!("Hello, world!"); + another_function(5); + print_labeled_measurement(5, 'h'); + println!("The value of x is -> {}", five()); + println!("The value of x is -> {}", plus_one(5)); +} + +fn another_function(x: i32) { + println!("The value of x is -> {}", x); +} + +fn print_labeled_measurement(value: i32, unit_label: char) { + println!("The measurement is: {}{}", value, unit_label); +} + +fn five() -> i32 { + 5 +} + +fn plus_one(x: i32) -> i32 { + x + 1 +} \ No newline at end of file