Rollup merge of #22515 - adamhjk:add-else-if-to-docs, r=steveklabnik

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

r? @steveklabnik
This commit is contained in:
Manish Goregaokar 2015-02-22 01:46:42 +05:30
commit 9d650ae723

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: