Fix section heading levels

This commit is contained in:
Carol (Nichols || Goulding) 2016-11-05 13:30:59 -04:00
parent e78569110d
commit 1a7783e08b
3 changed files with 12 additions and 12 deletions

View File

@ -1086,7 +1086,7 @@ fn main() {
Running this code will print `number was something other than zero`. Running this code will print `number was something other than zero`.
### Multiple Conditions with `else if` #### Multiple Conditions with `else if`
We can have multiple conditions by combining `if` and `else` in an `else if` We can have multiple conditions by combining `if` and `else` in an `else if`
expression. For example: expression. For example:
@ -1130,7 +1130,7 @@ Using too many `else if` expressions can clutter your code, so if you have more
than one, you might want to refactor your code. Chapter 6 describes a powerful than one, you might want to refactor your code. Chapter 6 describes a powerful
Rust branching construct called `match` for these cases. Rust branching construct called `match` for these cases.
### Using `if` in a `let` statement #### Using `if` in a `let` statement
Because `if` is an expression, we can use it on the right side of a `let` Because `if` is an expression, we can use it on the right side of a `let`
statement, for instance in Listing 3-4: statement, for instance in Listing 3-4:
@ -1213,7 +1213,7 @@ of `number` was only determined at runtime; the compiler would be more complex
and would make fewer guarantees about the code if it had to keep track of and would make fewer guarantees about the code if it had to keep track of
multiple hypothetical types for any variable. multiple hypothetical types for any variable.
## Repetition with Loops ### Repetition with Loops
Its often useful to execute a block of code more than once. For this task, Its often useful to execute a block of code more than once. For this task,
Rust provides several *loops*. A loop runs through the code inside the loop Rust provides several *loops*. A loop runs through the code inside the loop
@ -1222,7 +1222,7 @@ experiment with loops, lets make a new project called *loops*.
Rust has three kinds of loops: `loop`, `while`, and `for`. Lets try each one. Rust has three kinds of loops: `loop`, `while`, and `for`. Lets try each one.
### Repeating Code with `loop` #### Repeating Code with `loop`
The `loop` keyword tells Rust to execute a block of code over and over again The `loop` keyword tells Rust to execute a block of code over and over again
forever or until you explicitly tell it to stop. forever or until you explicitly tell it to stop.
@ -1265,7 +1265,7 @@ stop executing the loop. Recall that we did this in the guessing game in the
“Quitting After a Correct Guess” section of Chapter 2 to exit the “Quitting After a Correct Guess” section of Chapter 2 to exit the
program when the user won the game by guessing the correct number. program when the user won the game by guessing the correct number.
### Conditional Loops with `while` #### Conditional Loops with `while`
Its often useful for a program to evaluate a condition within a loop. While Its often useful for a program to evaluate a condition within a loop. While
the condition is true, the loop runs. When the condition ceases to be true, you the condition is true, the loop runs. When the condition ceases to be true, you
@ -1298,7 +1298,7 @@ This construct eliminates a lot of nesting that would be necessary if you used
`loop`, `if`, `else`, and `break`, and its clearer. While a condition holds `loop`, `if`, `else`, and `break`, and its clearer. While a condition holds
true, the code runs; otherwise, it exits the loop. true, the code runs; otherwise, it exits the loop.
### Looping Through a Collection with `for` #### Looping Through a Collection with `for`
You could use the `while` construct to loop over the elements of a collection, You could use the `while` construct to loop over the elements of a collection,
such as an array. For example: such as an array. For example:

Binary file not shown.

View File

@ -122,7 +122,7 @@ fn main() {
Running this code will print `number was something other than zero`. Running this code will print `number was something other than zero`.
### Multiple Conditions with `else if` #### Multiple Conditions with `else if`
We can have multiple conditions by combining `if` and `else` in an `else if` We can have multiple conditions by combining `if` and `else` in an `else if`
expression. For example: expression. For example:
@ -166,7 +166,7 @@ Using too many `else if` expressions can clutter your code, so if you have more
than one, you might want to refactor your code. Chapter 6 describes a powerful than one, you might want to refactor your code. Chapter 6 describes a powerful
Rust branching construct called `match` for these cases. Rust branching construct called `match` for these cases.
### Using `if` in a `let` statement #### Using `if` in a `let` statement
Because `if` is an expression, we can use it on the right side of a `let` Because `if` is an expression, we can use it on the right side of a `let`
statement, for instance in Listing 3-4: statement, for instance in Listing 3-4:
@ -249,7 +249,7 @@ of `number` was only determined at runtime; the compiler would be more complex
and would make fewer guarantees about the code if it had to keep track of and would make fewer guarantees about the code if it had to keep track of
multiple hypothetical types for any variable. multiple hypothetical types for any variable.
## Repetition with Loops ### Repetition with Loops
Its often useful to execute a block of code more than once. For this task, Its often useful to execute a block of code more than once. For this task,
Rust provides several *loops*. A loop runs through the code inside the loop Rust provides several *loops*. A loop runs through the code inside the loop
@ -258,7 +258,7 @@ experiment with loops, lets make a new project called *loops*.
Rust has three kinds of loops: `loop`, `while`, and `for`. Lets try each one. Rust has three kinds of loops: `loop`, `while`, and `for`. Lets try each one.
### Repeating Code with `loop` #### Repeating Code with `loop`
The `loop` keyword tells Rust to execute a block of code over and over again The `loop` keyword tells Rust to execute a block of code over and over again
forever or until you explicitly tell it to stop. forever or until you explicitly tell it to stop.
@ -301,7 +301,7 @@ stop executing the loop. Recall that we did this in the guessing game in the
“Quitting After a Correct Guess” section of Chapter 2 to exit the “Quitting After a Correct Guess” section of Chapter 2 to exit the
program when the user won the game by guessing the correct number. program when the user won the game by guessing the correct number.
### Conditional Loops with `while` #### Conditional Loops with `while`
Its often useful for a program to evaluate a condition within a loop. While Its often useful for a program to evaluate a condition within a loop. While
the condition is true, the loop runs. When the condition ceases to be true, you the condition is true, the loop runs. When the condition ceases to be true, you
@ -334,7 +334,7 @@ This construct eliminates a lot of nesting that would be necessary if you used
`loop`, `if`, `else`, and `break`, and its clearer. While a condition holds `loop`, `if`, `else`, and `break`, and its clearer. While a condition holds
true, the code runs; otherwise, it exits the loop. true, the code runs; otherwise, it exits the loop.
### Looping Through a Collection with `for` #### Looping Through a Collection with `for`
You could use the `while` construct to loop over the elements of a collection, You could use the `while` construct to loop over the elements of a collection,
such as an array. For example: such as an array. For example: