mirror of
https://github.com/RustyCab/LearnRustEasy.git
synced 2026-02-13 15:25:58 +08:00
update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
## 3.5 控制流
|
||||
# 3.5 控制流
|
||||
|
||||
Rust中的控制流结构主要包括:
|
||||
|
||||
@@ -7,7 +7,7 @@ Rust中的控制流结构主要包括:
|
||||
- while循环;
|
||||
- for .. in 循环。
|
||||
|
||||
### 3.5.1. if条件判断
|
||||
## 3.5.1. if条件判断
|
||||
|
||||
- if执行条件判断,示例如下:
|
||||
```Rust
|
||||
@@ -64,7 +64,7 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
### 3.5.2. loop循环
|
||||
## 3.5.2. loop循环
|
||||
|
||||
- loop重复执行代码
|
||||
```Rust
|
||||
@@ -126,7 +126,7 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
### 3.5.3. while条件循环
|
||||
## 3.5.3. while条件循环
|
||||
- while条件循环执行代码,当条件不满足后结束循环,如下:
|
||||
```Rust
|
||||
fn main() {
|
||||
@@ -156,7 +156,7 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
### 3.5.4. for .. in 循环
|
||||
## 3.5.4. for .. in 循环
|
||||
|
||||
for循环用来对一个集合的每个元素执行一些代码,使用方式如下:
|
||||
```Rust
|
||||
|
||||
Reference in New Issue
Block a user