summaryrefslogtreecommitdiff
path: root/rust/structs.rs
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-07-10 22:24:20 +0200
committerCarlos Maiolino <[email protected]>2025-07-10 22:24:20 +0200
commit869e68986aa8f69af6e7842260a68d1e5c6f796f (patch)
tree63b6b5ffc3d19414233d4629a533c0d9bf3cbf72 /rust/structs.rs
parent20834dcc57537cd95260a4a22f5d91a027adfd35 (diff)
Add a bunch of code
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'rust/structs.rs')
-rw-r--r--rust/structs.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/rust/structs.rs b/rust/structs.rs
new file mode 100644
index 0000000..0d0ac64
--- /dev/null
+++ b/rust/structs.rs
@@ -0,0 +1,25 @@
+struct Student {
+ name: String,
+ age: u8,
+ gradeA: f64,
+ gradeB: f64,
+}
+
+fn main() {
+ let mut student1 = Student {
+ name: String::from("Tiao Barbosa"),
+ age: 59,
+ gradeA: 5.9,
+ gradeB: 6.5,
+ };
+
+ println!("Name: {} Age: {} GradeA: {} GradeB: {}",
+ student1.name, student1.age,
+ student1.gradeA, student1.gradeB);
+
+ student1.name = String::from("Ronaldo do curintia");
+ println!("Name: {} Age: {} GradeA: {} GradeB: {}",
+ student1.name, student1.age,
+ student1.gradeA, student1.gradeB);
+
+}