1

I'm just learning Rust, and when I run the below code, it waits for my input before iterating through the for loop. Why does this happen, and how can I stop it?

pub fn whatever() {

    for i in 1..121 {
        print!("{} ", i);
    }

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    let n: i32 = input.trim().parse().unwrap();
}

0 Answers0