From 8395cdc9a56ddce8e966b23ed02b189c8bf8a2d2 Mon Sep 17 00:00:00 2001 From: Shymala Sidharth Date: Thu, 20 Apr 2023 16:29:14 +1200 Subject: [PATCH] working on rustlings --- exercises/intro/intro1.rs | 2 +- exercises/intro/intro2.rs | 7 +++++-- exercises/primitive_types/primitive_types1.rs | 4 ++-- exercises/primitive_types/primitive_types2.rs | 4 ++-- exercises/primitive_types/primitive_types3.rs | 4 ++-- exercises/variables/variables6.rs | 2 ++ 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/exercises/intro/intro1.rs b/exercises/intro/intro1.rs index cfc55c30..3dd1c9cb 100644 --- a/exercises/intro/intro1.rs +++ b/exercises/intro/intro1.rs @@ -9,7 +9,7 @@ // when you change one of the lines below! Try adding a `println!` line, or try changing // what it outputs in your terminal. Try removing a semicolon and see what happens! -// I AM NOT DONE + fn main() { println!("Hello and"); diff --git a/exercises/intro/intro2.rs b/exercises/intro/intro2.rs index efc1af20..ffe0dbeb 100644 --- a/exercises/intro/intro2.rs +++ b/exercises/intro/intro2.rs @@ -2,8 +2,11 @@ // Make the code print a greeting to the world. // Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE + fn main() { - println!("Hello {}!"); + + let mut world = String::from("World"); + + println!("Hello {world}!"); } diff --git a/exercises/primitive_types/primitive_types1.rs b/exercises/primitive_types/primitive_types1.rs index 09121392..95fa6268 100644 --- a/exercises/primitive_types/primitive_types1.rs +++ b/exercises/primitive_types/primitive_types1.rs @@ -2,7 +2,7 @@ // Fill in the rest of the line that has code missing! // No hints, there's no tricks, just get used to typing these :) -// I AM NOT DONE + fn main() { // Booleans (`bool`) @@ -12,7 +12,7 @@ fn main() { println!("Good morning!"); } - let // Finish the rest of this line like the example! Or make it be false! + let is_evening = true;// Finish the rest of this line like the example! Or make it be false! if is_evening { println!("Good evening!"); } diff --git a/exercises/primitive_types/primitive_types2.rs b/exercises/primitive_types/primitive_types2.rs index 8730baab..74424d45 100644 --- a/exercises/primitive_types/primitive_types2.rs +++ b/exercises/primitive_types/primitive_types2.rs @@ -2,7 +2,7 @@ // Fill in the rest of the line that has code missing! // No hints, there's no tricks, just get used to typing these :) -// I AM NOT DONE + fn main() { // Characters (`char`) @@ -18,7 +18,7 @@ fn main() { println!("Neither alphabetic nor numeric!"); } - let // Finish this line like the example! What's your favorite character? + let your_character = 'S'; // Finish this line like the example! What's your favorite character? // Try a letter, try a number, try a special character, try a character // from a different language than your own, try an emoji! if your_character.is_alphabetic() { diff --git a/exercises/primitive_types/primitive_types3.rs b/exercises/primitive_types/primitive_types3.rs index fa7d019a..399e40b1 100644 --- a/exercises/primitive_types/primitive_types3.rs +++ b/exercises/primitive_types/primitive_types3.rs @@ -2,10 +2,10 @@ // Create an array with at least 100 elements in it where the ??? is. // Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE + fn main() { - let a = ??? + let a = [1; 100]; if a.len() >= 100 { println!("Wow, that's a big array!"); diff --git a/exercises/variables/variables6.rs b/exercises/variables/variables6.rs index fb2c6ca6..3564e051 100644 --- a/exercises/variables/variables6.rs +++ b/exercises/variables/variables6.rs @@ -8,3 +8,5 @@ const NUMBER: u32 = 3; fn main() { println!("Number {}", NUMBER); } + +