How to continue outer loop in Rust

1 Answer

0 votes
fn main() {
    let a = ['a', 'b', 'c', 'd', 'e', 'f'];
    let b = [     'b',      'd'     ];
    
    'outer: for vala in &a {
        for valb in &b {
            if vala == valb {
                continue 'outer;
            }
        }
        println!("{}", vala);
    }
}



/*
run:

a
c
e
f

*/

 



answered Apr 25, 2025 by avibootz

Related questions

1 answer 111 views
1 answer 176 views
3 answers 183 views
2 answers 117 views
1 answer 153 views
153 views asked Apr 24, 2025 by avibootz
...