2 ms·
Rust has ? for early returns when returning an Option, and it has named breaks as well. fn foo(xs: Vec<u32>, ys: Vec<u32>) { 'bar: for x in &xs {
by bschwindHN 9y ago
Rust has ? for early returns when returning an Option, and it has named breaks as well.
fn foo(xs: Vec<u32>, ys: Vec<u32>) {
'bar: for x in &xs {
for y in &ys {
if *y == 42 {
break 'bar;
}
}
}
}