3. Guessing Game

Let's start off with a hands-on project! We'll learn some new concepts by using them in a real program.

Process a Guess

You can either write over your Hello World program or you can create a new repl.it project. Do not just add a new file in repl.it!

use std::io;
fn main() {
println!("Guess the number!");
println!("Please input your guess.");
let mut guess = String::new();
io::stdin().read_line(&mut guess)
.expect("Failed to read line");
println!("You guessed: {}", guess);

Let's go ahead and run it: