From 1b51c7f82fd0d512b688af81ab05fa282177e782 Mon Sep 17 00:00:00 2001 From: Max Boewer Date: Thu, 8 Dec 2022 00:29:41 +0100 Subject: [PATCH] Started working on strings --- exercises/strings/strings1.rs | 6 +++--- exercises/strings/strings2.rs | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/exercises/strings/strings1.rs b/exercises/strings/strings1.rs index 0de86a1d..aedac3e0 100644 --- a/exercises/strings/strings1.rs +++ b/exercises/strings/strings1.rs @@ -2,13 +2,13 @@ // Make me compile without changing the function signature! // Execute `rustlings hint strings1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE + fn main() { - let answer = current_favorite_color(); + let answer = current_favorite_color(); println!("My current favorite color is {}", answer); } fn current_favorite_color() -> String { - "blue" + "blue".to_string() } diff --git a/exercises/strings/strings2.rs b/exercises/strings/strings2.rs index 0c48ec95..4f071af2 100644 --- a/exercises/strings/strings2.rs +++ b/exercises/strings/strings2.rs @@ -2,11 +2,10 @@ // Make me compile without changing the function signature! // Execute `rustlings hint strings2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE fn main() { - let word = String::from("green"); // Try not changing this line :) - if is_a_color_word(word) { + let word = String::from("purple"); // Try not changing this line :) + if is_a_color_word(&word) { println!("That is a color word I know!"); } else { println!("That is not a color word I know.");