rust-ape-example/src/bin/flow_control_loop_nested.rs
2022-09-07 10:49:49 +05:30

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();
}