Hey so I'm attempting to get a user input and reference that inside of an if statement but i cant quite figure out how to use the if statement correctly I assume I have everything right and even following documentation online it seems right from what I can observe.
Here's the code snippet I'm trying to work on
use std::{thread, time::Duration};
fn main(){
let mut line = String::new();
println!("Will you help the man? (Y/N)");
let _b1 = std::io::stdin().read_line(&mut line).unwrap();
print!("{}",line);
let y = "Y";
if line == y{
println!("The man gives you a peice of gold and thanks you.");
thread::sleep(Duration::from_secs(5))
}
else{
println!("You walk past the man and ignore him");
thread::sleep(Duration::from_secs(5))
}
}