Skip to content

Commit

Permalink
Merge pull request #2321 from gokhanettin/fix-guessing-game-listing-e…
Browse files Browse the repository at this point in the history
…xplanation

Fix guessing game listing explanation
  • Loading branch information
steveklabnik committed May 3, 2020
2 parents cea955d + 8b4b797 commit 6247be1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ch02-00-guessing-game-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,19 +650,18 @@ cannot compare a string and a number type.

Ultimately, we want to convert the `String` the program reads as input into a
real number type so we can compare it numerically to the secret number. We can
do that by adding the following two lines to the `main` function body:
do that by adding another line to the `main` function body:

<span class="filename">Filename: src/main.rs</span>

```rust,ignore
{{#rustdoc_include ../listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs:here}}
```

The two new lines are:
The line is:

```rust,ignore
let guess: u32 = guess.trim().parse()
.expect("Please type a number!");
let guess: u32 = guess.trim().parse().expect("Please type a number!");
```

We create a variable named `guess`. But wait, doesn’t the program already have
Expand Down

0 comments on commit 6247be1

Please sign in to comment.