When I run this, if the values c, C, f, or F are input the loop correctly breaks and subsequent code executes. However if invalid input is found the loop repeats as expected, but the mutable direction variable is never updated with the new input so the loop executes indefinitely. It is acting as if it is not mutable and is allowing only 1 assignment. No errors or warnings are thrown at compile time. Any ideas would be appreciated. Thanks.
fn main() {
let mut direction = String::new();
loop {
println!("Enter C to convert Celsius to Farenheit");
println!("Enter F to convert Farenheit to Celsius");
io::stdin()
.read_line(&mut direction)
.expect("Failed to read line");
println!("direction = {}", direction);
if (direction.trim().to_uppercase() == "C") || (direction.trim().to_uppercase() == "F"){
break;
}
}
//subsequent code
}