From bb4e324a7f295510a89ca09ebdfc7fdbe971e6d8 Mon Sep 17 00:00:00 2001 From: AlphonseMehounme Date: Thu, 28 Nov 2024 21:20:39 +0100 Subject: [PATCH] add rustfinity constant and primitive data solutions --- Rust/rustifinity/challenges/constants.rs | 9 +++++++++ Rust/rustifinity/challenges/primitive-data-types.rs | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Rust/rustifinity/challenges/constants.rs create mode 100644 Rust/rustifinity/challenges/primitive-data-types.rs diff --git a/Rust/rustifinity/challenges/constants.rs b/Rust/rustifinity/challenges/constants.rs new file mode 100644 index 0000000..3fc2fc4 --- /dev/null +++ b/Rust/rustifinity/challenges/constants.rs @@ -0,0 +1,9 @@ +// Define a constant MAX_SIZE with a value of 100. +// NOTE: Define the constant outside the main function +// Your code here + +pub fn main() -> i32 { + MAX_SIZE +} + +const MAX_SIZE : i32 = 100; diff --git a/Rust/rustifinity/challenges/primitive-data-types.rs b/Rust/rustifinity/challenges/primitive-data-types.rs new file mode 100644 index 0000000..4256439 --- /dev/null +++ b/Rust/rustifinity/challenges/primitive-data-types.rs @@ -0,0 +1,10 @@ +pub fn data_types() { + // 1. Define variable `x` of type `u8` + let x : u8; + // 2. Define variable `y` of type `f64` + let y : f64; + // 3. Define variable `z` of type `bool` + let z : bool; + // 4. Define variable `a` of type `char` + let a : char; +} \ No newline at end of file