Skip to content

Commit

Permalink
fix zh-cn docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfettes committed Jan 8, 2024
1 parent 119155b commit 7b0689d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zh-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ while x == y {
MoonBit 还提供 `break``continue` 语句来控制循环流。

```rust
var i = 0
var n = 0
let mut i = 0
let mut n = 0

while i < 10 {
i = i + 1
Expand All @@ -218,7 +218,7 @@ println(n) // outputs 25
`while` 循环还可以有一个可选的 "continue" 块。"continue" 块位于循环条件和循环体之间,和循环条件用逗号分隔。它会在每次循环的循环体之后、下一次循环的循环条件之前被执行:

```rust
var i = 0
let mut i = 0
while i < 10, i = i + 1 {
println(i)
} // outputs 0 to 9
Expand All @@ -227,7 +227,7 @@ while i < 10, i = i + 1 {
如果在一个 "continue" 块里有多个语句,它们需要被花括号包裹。循环体中的 `continue` 语句不会跳过 "continue" 块。例如,下面的例子会输出小于 10 的所有奇数:

```rust
var i = 1
let mut i = 1
while i < 10, i = i + 1 {
if (i % 2 == 0) {
continue
Expand Down Expand Up @@ -343,7 +343,7 @@ fn init {
let zero = 0

fn init {
var i = 10
let mut i = 10
i = 20
print(i + zero)
}
Expand Down

0 comments on commit 7b0689d

Please sign in to comment.