mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 23:38:41 +08:00
Fix some headings that were too far in
This commit is contained in:
parent
d92f03be9c
commit
7031318d01
@ -874,7 +874,7 @@ Typing `quit` actually quits the game, but so will any other non-number input.
|
|||||||
However, this is suboptimal to say the least. We want the game to automatically
|
However, this is suboptimal to say the least. We want the game to automatically
|
||||||
stop when the correct number is guessed.
|
stop when the correct number is guessed.
|
||||||
|
|
||||||
#### Quitting After a Correct Guess
|
### Quitting After a Correct Guess
|
||||||
|
|
||||||
Let’s program the game to quit when the user wins by adding a `break`:
|
Let’s program the game to quit when the user wins by adding a `break`:
|
||||||
|
|
||||||
@ -923,7 +923,7 @@ By adding the `break` line after `You win!`, the program will exit the loop
|
|||||||
when the user guesses the secret number correctly. Exiting the loop also means
|
when the user guesses the secret number correctly. Exiting the loop also means
|
||||||
exiting the program, because the loop is the last part of `main`.
|
exiting the program, because the loop is the last part of `main`.
|
||||||
|
|
||||||
#### Handling Invalid Input
|
### Handling Invalid Input
|
||||||
|
|
||||||
To further refine the game’s behavior, rather than crashing the program when
|
To further refine the game’s behavior, rather than crashing the program when
|
||||||
the user inputs a non-number, let’s make the game ignore a non-number so the
|
the user inputs a non-number, let’s make the game ignore a non-number so the
|
||||||
|
@ -897,7 +897,7 @@ Typing `quit` actually quits the game, but so will any other non-number input.
|
|||||||
However, this is suboptimal to say the least. We want the game to automatically
|
However, this is suboptimal to say the least. We want the game to automatically
|
||||||
stop when the correct number is guessed.
|
stop when the correct number is guessed.
|
||||||
|
|
||||||
#### Quitting After a Correct Guess
|
### Quitting After a Correct Guess
|
||||||
|
|
||||||
Let’s program the game to quit when the user wins by adding a `break`:
|
Let’s program the game to quit when the user wins by adding a `break`:
|
||||||
|
|
||||||
@ -946,7 +946,7 @@ By adding the `break` line after `You win!`, the program will exit the loop
|
|||||||
when the user guesses the secret number correctly. Exiting the loop also means
|
when the user guesses the secret number correctly. Exiting the loop also means
|
||||||
exiting the program, because the loop is the last part of `main`.
|
exiting the program, because the loop is the last part of `main`.
|
||||||
|
|
||||||
#### Handling Invalid Input
|
### Handling Invalid Input
|
||||||
|
|
||||||
To further refine the game’s behavior, rather than crashing the program when
|
To further refine the game’s behavior, rather than crashing the program when
|
||||||
the user inputs a non-number, let’s make the game ignore a non-number so the
|
the user inputs a non-number, let’s make the game ignore a non-number so the
|
||||||
|
Loading…
Reference in New Issue
Block a user