> For the complete documentation index, see [llms.txt](https://jmkoni.gitbook.io/rust/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jmkoni.gitbook.io/rust/guessing-game.md).

# 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!

{% code title="main.rs" %}

```rust
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);
}
```

{% endcode %}

Let's go ahead and run it:

![](https://2720625490-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LBlB5eCVilPmyCc9hb0%2F-LBlSURMVV3zkjDhOHC0%2F-LBlUDHrygnnUwFCf338%2FScreen%20Shot%202018-05-05%20at%202.07.10%20PM.png?alt=media\&token=fd5b292f-7a86-43bb-9e83-3a62d21dc2c8)
