Breaks and labels in loops?
IT is possible to use a label to specify which enclosing loop is affected.
1
2
3
4
5
6
7
8
let s = 'outer: loop {
for idx in 0..10 {
if idx == 4 {
break 'outer idx;
}
}
};
assert!(s == 4);