Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

loop label in rust

'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");
 
PREVIOUS NEXT
Tagged: #loop #label #rust
ADD COMMENT
Topic
Name
1+5 =