mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-05-28 16:28:08 +00:00
d976dc883b
via panflute and https://github.com/rust-lang/rust-by-example
30 lines
502 B
Rust
30 lines
502 B
Rust
// ./src/flow_control/loop/nested.md
|
|
|
|
|
|
#![allow(unreachable_code)]
|
|
|
|
fn part0() {
|
|
'outer: loop {
|
|
println!("Entered the outer loop");
|
|
|
|
'inner: loop {
|
|
println!("Entered the inner loop");
|
|
|
|
// This would break only the inner loop
|
|
//break;
|
|
|
|
// This breaks the outer loop
|
|
break 'outer;
|
|
}
|
|
|
|
println!("This point will never be reached");
|
|
}
|
|
|
|
println!("Exited the outer loop");
|
|
}
|
|
|
|
pub fn main() {
|
|
part0();
|
|
}
|
|
|