From fa7fdfa1ab924236e0561ccd51ee462c3d7517c0 Mon Sep 17 00:00:00 2001 From: Hua Chen <62733317+gaochuntie@users.noreply.github.com> Date: Thu, 1 Feb 2024 12:51:22 +0800 Subject: [PATCH] Update ch03-05-control-flow.md A small note For me,if read too fast,may miss the note and regard 1..9 is head and end included --- src/ch03-05-control-flow.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ch03-05-control-flow.md b/src/ch03-05-control-flow.md index 4b7c314..3f254f7 100644 --- a/src/ch03-05-control-flow.md +++ b/src/ch03-05-control-flow.md @@ -235,6 +235,7 @@ again! `for` 循环的安全性和简洁性使得它成为 Rust 中使用最多的循环结构。即使是在想要循环执行代码特定次数时,例如示例 3-3 中使用 `while` 循环的倒计时例子,大部分 Rustacean 也会使用 `for` 循环。这么做的方式是使用 `Range`,它是标准库提供的类型,用来生成从一个数字开始到另一个数字之前结束的所有数字的序列。 下面是一个使用 `for` 循环来倒计时的例子,它还使用了一个我们还未讲到的方法,`rev`,用来反转 range: +注意: 以下代码不会踏足到数字 9 ,仅从一个数字开始到另一个数字之前 文件名:src/main.rs