第8章 流程控制

流程控制 — Rust By Example

译文 · 基于 Rust By Example

原文链接: https://doc.rust-lang.org/stable/rust-by-example/flow_control.html

流程控制

​ 任何编程语言都包含的一个必要部分就是改变控制流程:if/else,for 等。让我们谈谈 Rust 语言中的这部分内容。


01-if/else

if/else — Rust By Example

02-loop 循环

loop 循环 — Rust By Example

03-while 循环

while 循环 — Rust By Example

04-for 循环和区间

for 循环和区间 — Rust By Example

05-match 匹配

match 匹配 — Rust By Example

06-if let

if let — Rust By Example

07-let-else

let-else — Rust By Example

08-while let

while let — Rust By Example

最后修改 October 2, 2026: 更新 (f3447ada6)