diff --git a/src/main.rs b/src/main.rs index 2498511..a6a2b12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,14 +9,13 @@ fn main() { std::io::stdin() .read_line(&mut input) .expect("Failed to read line"); - let input = input.trim(); // Parse is for numbers we use letters here. A &str is more usefull in this case as we dont want to mutate it - match input { // Match is a better way then chaining if/else expressions. - "y" => number += rng, // let expression would have shadowed the original variable and would have droped to soon. Use add assign insted - "n" => continue, + let input = input.trim(); + match input { + "y" => number += rng, + "n" => println!("maybe the next number"), _ => { println!("Option unknown") } } } -} - +} \ No newline at end of file