Commit ac53389

mo khan <mo@mokhan.ca>
2025-06-03 16:32:55
write example
1 parent 88fb709
Changed files (1)
5.2
5.2/src/main.rs
@@ -1,3 +1,4 @@
+/*
 // Regular struct
 struct User {
     active: bool,
@@ -38,3 +39,18 @@ fn build_user(email: String, username: String) -> User {
         sign_in_count: 1,
     }
 }
+*/
+
+fn main() {
+    let width1 = 30;
+    let height1 = 50;
+
+    println!(
+        "The area of the rectangle is {} square pixels.",
+        area(width1, height1)
+    );
+}
+
+fn area(width: u32, height: u32) -> u32 {
+    width * height
+}