diff --git a/rectangles/src/main.rs b/rectangles/src/main.rs index dd03429..e4f45e8 100644 --- a/rectangles/src/main.rs +++ b/rectangles/src/main.rs @@ -4,12 +4,20 @@ struct Rectangle { height: u32, } +impl Rectangle { + fn area(&self) -> u32 { + self.width * self.height + } +} + fn main() { - let scale = 2; let rect1 = Rectangle { - width: dbg!(30 * scale), + width: 30, height: 50, }; - dbg!(&rect1); + println!( + "The area of the rectangle is {} square pixels.", + rect1.area() + ); }