im trying to create a calculator with a that if the user writes that he doesnt want to do another operation it breaks it never does.
fn main {
loop {
// calculator code
println!("result: {}", result);
println!("do you want to do another operation(y/n)? ");
let mut answer = String::new();
io::stdin().read_line(&mut answer).expect("failed to read line");
if answer == "n"{
println!("ok, goodbye!");
break;
}
}
}
this is my first rust project so i tried very little