Introduction
In this lab, we learn about nesting and labeling loops in Rust, where we can use the break
and continue
statements to terminate or skip outer loops within nested loops by annotating loops with labels.
Note: If the lab does not specify a file name, you can use any file name you want. For example, you can use main.rs
, compile and run it with 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{{"`Nesting and Labels`"}}
rust/function_syntax -.-> lab-99305{{"`Nesting and Labels`"}}
rust/expressions_statements -.-> lab-99305{{"`Nesting and Labels`"}}
end