diff --git a/BasicSyntax/enum/main.exe b/BasicSyntax/enum/main.exe new file mode 100644 index 0000000..6f6ef08 Binary files /dev/null and b/BasicSyntax/enum/main.exe differ diff --git a/BasicSyntax/enum/main.pdb b/BasicSyntax/enum/main.pdb new file mode 100644 index 0000000..77be837 Binary files /dev/null and b/BasicSyntax/enum/main.pdb differ diff --git a/BasicSyntax/enum/main.rs b/BasicSyntax/enum/main.rs new file mode 100644 index 0000000..c8768f7 --- /dev/null +++ b/BasicSyntax/enum/main.rs @@ -0,0 +1,27 @@ +enum Color{ + red(u8), + green(u8), + blue(u8) +} + +fn setcl(color: Color){ + match color{ + Color::red(num) => { + println!("red oh yeah with num {}", num); + }, + Color::green(num) => { + println!("green oh yeah with num {}", num); + }, + Color::blue(num) => { + println!("blue oh yeah with num {}", num); + } + other => { + println!("#UNDEFINED"); + } + } +} + +fn main(){ + let a: Color = Color::red(200); + setcl(a); +} \ No newline at end of file diff --git a/BasicSyntax/structtest/struct.exe b/BasicSyntax/structtest/struct.exe new file mode 100644 index 0000000..17894fe Binary files /dev/null and b/BasicSyntax/structtest/struct.exe differ diff --git a/BasicSyntax/structtest/struct.pdb b/BasicSyntax/structtest/struct.pdb new file mode 100644 index 0000000..95bfbe4 Binary files /dev/null and b/BasicSyntax/structtest/struct.pdb differ diff --git a/BasicSyntax/structtest/struct.rs b/BasicSyntax/structtest/struct.rs new file mode 100644 index 0000000..77ea017 --- /dev/null +++ b/BasicSyntax/structtest/struct.rs @@ -0,0 +1,31 @@ +struct Student{ + name: String, + age: i64, + birth: String, + score: f64 +} + +trait make_student{ + fn get_name(&self) -> &str; + + fn print(&self){ + println!("{0} is my name, Oh yeah", &self.get_name()); + } +} + +impl make_student for Student{ + fn get_name(&self) -> &str { + return &self.name; + } + +} + +fn main(){ + let s = Student{ + name: String::from("Van"), + age: 19, + birth: String::from("2025-09-30"), + score: 99.99 + }; + s.print(); +} \ No newline at end of file