Files
RustTutorials/src/FlowOfControl/Loop/NestingAndLabels.rs
2020-06-11 18:01:30 -04:00

23 lines
372 B
Rust

#[allow(unreachable_code)]
#[allow(unused_labels)]
pub fn main(){
'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");
}