diff --git a/rectangles/Cargo.lock b/rectangles/Cargo.lock new file mode 100644 index 0000000..3eca8f1 --- /dev/null +++ b/rectangles/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "rectangles" +version = "0.1.0" diff --git a/rectangles/Cargo.toml b/rectangles/Cargo.toml new file mode 100644 index 0000000..703c9d9 --- /dev/null +++ b/rectangles/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "rectangles" +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/rectangles/src/main.rs b/rectangles/src/main.rs new file mode 100644 index 0000000..a587139 --- /dev/null +++ b/rectangles/src/main.rs @@ -0,0 +1,12 @@ +fn main() { + let rect1 = (30, 50); + + println!( + "The area of a rectangle is {} square pixels", + area(rect1) + ); +} + +fn area(dimensions: (u32, u32)) -> u32 { + dimensions.0 * dimensions.1 +} \ No newline at end of file