简介
在本实验中,我们将学习 Rust 中循环的嵌套和标记,通过给循环添加标签,我们可以使用 break
和 continue
语句来终止或跳过嵌套循环中的外层循环。
注意:如果实验未指定文件名,你可以使用任何你想要的文件名。例如,你可以使用
main.rs
,并通过rustc main.rs &&./main
来编译和运行它。
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
rust(("Rust")) -.-> rust/DataTypesGroup(["Data Types"])
rust(("Rust")) -.-> rust/FunctionsandClosuresGroup(["Functions and Closures"])
rust/DataTypesGroup -.-> rust/string_type("String Type")
rust/FunctionsandClosuresGroup -.-> rust/function_syntax("Function Syntax")
rust/FunctionsandClosuresGroup -.-> rust/expressions_statements("Expressions and Statements")
subgraph Lab Skills
rust/string_type -.-> lab-99305{{"嵌套与标签"}}
rust/function_syntax -.-> lab-99305{{"嵌套与标签"}}
rust/expressions_statements -.-> lab-99305{{"嵌套与标签"}}
end