Skip to content

Commit

Permalink
Ch. 2: tweak a phrase to avoid derailing some readers
Browse files Browse the repository at this point in the history
Multiple people have filed or commented on issues over the past few
years (at least #3782, #4101, #4090, and #3921; and possibly others I
have not found) because seeing “compare” here led them to jump ahead to
the conversion (in the next paragraph). The text was technically correct
as it stood, but since it kept derailing/hijacking people’s train of
thought, tweaking it seems helpful.
  • Loading branch information
chriskrycho committed Dec 2, 2024
1 parent 614c19c commit f347bb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ch02-00-guessing-game-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ often used when you want to convert a value from one type to another type.
We bind this new variable to the expression `guess.trim().parse()`. The `guess`
in the expression refers to the original `guess` variable that contained the
input as a string. The `trim` method on a `String` instance will eliminate any
whitespace at the beginning and end, which we must do to be able to compare the
string to the `u32`, which can only contain numerical data. The user must press
whitespace at the beginning and end, which we must do before we can convert the
string to a `u32`, which can only contain numerical data. The user must press
<kbd>enter</kbd> to satisfy `read_line` and input their guess, which adds a
newline character to the string. For example, if the user types <kbd>5</kbd> and
presses <kbd>enter</kbd>, `guess` looks like this: `5\n`. The `\n` represents
Expand Down

0 comments on commit f347bb5

Please sign in to comment.