Add documentation for else if to trpl

Adds an example of `else if` to the If section of The Rust Programming
Language.

r? @steveklabnik
This commit is contained in:
Adam Jacob 2015-02-18 16:15:32 -08:00
parent dfc5c0f1e8
commit cec404a066

View file

@ -34,6 +34,20 @@ if x == 5 {
}
```
If there is more than one case, use an `else if`:
```rust
let x = 5;
if x == 5 {
println!("x is five!");
} else if x == 6 {
println!("x is six!");
} else {
println!("x is not five or six :(");
}
```
This is all pretty standard. However, you can also do this: