Merge pull request #39 from akshitgautam42/Ex-39

Exercise 39
This commit is contained in:
Akshit Gautam 2023-11-13 18:04:30 +05:30 committed by GitHub
commit e23df5f4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,17 +5,17 @@
// 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) {
if is_a_color_word(&word) {
println!("That is a color word I know!");
} else {
println!("That is not a color word I know.");
}
}
fn is_a_color_word(attempt: &str) -> bool {
fn is_a_color_word(attempt: &String) -> bool {
attempt == "green" || attempt == "blue" || attempt == "red"
}