Merge pull request #20 from geometryolife/fix-content

update chapter 3.4 heading and some symbols
This commit is contained in:
Davirain
2023-06-12 00:30:30 +08:00
committed by GitHub
2 changed files with 10 additions and 10 deletions

View File

@@ -8,13 +8,13 @@
本节主要简单介绍代码注释和文档注释,对于注释的其它功能,我们后面再深入。
## 3.4.1. 代码注释
## 3.4.1 代码注释
代码注释有两种:
1行注释使用“//”
1行注释使用`//`
2块注释使用/*... */
2块注释使用`/* ... */`
示例如下:
@@ -38,13 +38,13 @@ fn main() {
}
```
## 3.4.2.文档注释
## 3.4.2 文档注释
Rust提供了cargo doc命令可以把文档注释转换成html网页最终展示给用户。文档注释也有文档行注释和文档块注释
1文档行注释使用///;
1文档行注释使用`///`;
2文档块注释使用/**...*/
2文档块注释使用`/** ... */`
示例如下:

View File

@@ -7,7 +7,7 @@ Rust中的控制流结构主要包括
- `while`循环;
- `for .. in` 循环。
## 3.5.1. if条件判断
## 3.5.1 if条件判断
- `if`执行条件判断,示例如下:
@@ -67,7 +67,7 @@ Rust中的控制流结构主要包括
}
```
## 3.5.2. loop循环
## 3.5.2 loop循环
- loop重复执行代码
@@ -134,7 +134,7 @@ Rust中的控制流结构主要包括
}
```
## 3.5.3. while条件循环
## 3.5.3 while条件循环
- `while`条件循环执行代码,当条件不满足时结束循环,如下:
@@ -167,7 +167,7 @@ Rust中的控制流结构主要包括
}
```
## 3.5.4. `for .. in` 循环
## 3.5.4 `for .. in` 循环
`for`循环用来对一个集合的每个元素执行一些代码,使用方式如下: