From b4725f95a8678a77b452400c2606e8a8c7554ce4 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 27 May 2024 15:16:24 -0600 Subject: [PATCH] Use `` instead of `` This has some reasonably nice built-in presentation in modern browsers, and may also yield a small accessibility improvement. Fixes #3929 --- src/ch02-00-guessing-game-tutorial.md | 23 ++++++++++---------- src/ch03-05-control-flow.md | 13 +++++------ src/ch20-01-single-threaded.md | 8 +++---- src/ch20-03-graceful-shutdown-and-cleanup.md | 8 +++---- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/ch02-00-guessing-game-tutorial.md b/src/ch02-00-guessing-game-tutorial.md index f80ad52082..5aebefdd98 100644 --- a/src/ch02-00-guessing-game-tutorial.md +++ b/src/ch02-00-guessing-game-tutorial.md @@ -682,13 +682,12 @@ 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 -enter to satisfy `read_line` and input their -guess, which adds a newline character to the string. For example, if the user -types 5 and presses enter, `guess` looks like this: `5\n`. The `\n` -represents “newline.” (On Windows, pressing enter results in a carriage return and a newline, -`\r\n`.) The `trim` method eliminates `\n` or `\r\n`, resulting in just `5`. +enter to satisfy `read_line` and input their guess, which adds a +newline character to the string. For example, if the user types 5 and +presses enter, `guess` looks like this: `5\n`. The `\n` represents +“newline.” (On Windows, pressing enter results in a carriage return +and a newline, `\r\n`.) The `trim` method eliminates `\n` or `\r\n`, resulting +in just `5`. The [`parse` method on strings][parse] converts a string to another type. Here, we use it to convert from a string to a number. We need to @@ -762,11 +761,11 @@ and run the program again. The program will now ask for another guess forever, which actually introduces a new problem. It doesn’t seem like the user can quit! The user could always interrupt the program by using the keyboard shortcut -ctrl-c. But there’s another way to escape this -insatiable monster, as mentioned in the `parse` discussion in [“Comparing the -Guess to the Secret Number”](#comparing-the-guess-to-the-secret-number): if the user enters a non-number answer, the program will crash. We -can take advantage of that to allow the user to quit, as shown here: +ctrl-c. But there’s another way to escape this insatiable +monster, as mentioned in the `parse` discussion in [“Comparing the Guess to the +Secret Number”](#comparing-the-guess-to-the-secret-number): if +the user enters a non-number answer, the program will crash. We can take +advantage of that to allow the user to quit, as shown here: