While doing the guessing_game, I’ve bumped into weird behaviour of the program.
I’ve decided to mess around and tweak (which I usually do) the code a little bit:
... // I don't want to put an input in a new line print!("Please input your guess: "); let mut guess = String::new(); io::stdin().read_line(&mut guess) .ok() .expect("Failed to read line"); ...
And it compiled! Here how it ran, notice that it first takes the input and then prints the request text:
Running `target/debug/guessing_game` Guess the number! 42 Please input your guess: You guessed: 42
Now I’m wondering, if it’s ok to do that?