fn main() {
let mut input = String::new();
loop {
std::io::stdin()
.read_line(&mut input)
.expect("error: unable to read user input");
println!("input is: {}", input);
}
}
When I first enter hello
it will show input is: hello
, then no matter what I enter later it will always show input is: hello
, so read_line
doesn't mutate the input
variable. Why does this happen?