summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-03 10:32:55 -0600
committermo khan <mo@mokhan.ca>2025-06-03 10:32:55 -0600
commitac533895fd3dfe461615363c41e33eb2af799a71 (patch)
treeb07a84e2fbaa301db7a11ff488576ba7f1a1647a
parent88fb7091d2604b78388b90b37368ea493cc604f7 (diff)
write example
-rw-r--r--5.2/src/main.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/5.2/src/main.rs b/5.2/src/main.rs
index ac3a4e0..827710a 100644
--- a/5.2/src/main.rs
+++ b/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
+}