From 869e68986aa8f69af6e7842260a68d1e5c6f796f Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Thu, 10 Jul 2025 22:24:20 +0200 Subject: Add a bunch of code Signed-off-by: Carlos Maiolino --- rust/structs.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 rust/structs.rs (limited to 'rust/structs.rs') 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); + +} -- cgit v1.2.3