rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

strings2.rs (433B)


      1 // TODO: Fix the compiler error in the `main` function without changing this function.
      2 fn is_a_color_word(attempt: &str) -> bool {
      3     attempt == "green" || attempt == "blue" || attempt == "red"
      4 }
      5 
      6 fn main() {
      7     let word = String::from("green"); // Don't change this line.
      8 
      9     if is_a_color_word(&word) {
     10         println!("That is a color word I know!");
     11     } else {
     12         println!("That is not a color word I know.");
     13     }
     14 }