提交 9d650ae7 编写于 作者: M Manish Goregaokar

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
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册