rust/tests/source/label_break.rs

28 lines
417 B
Rust
Raw Normal View History

2018-05-21 06:18:06 +02:00
// format with label break value.
fn main() {
'empty_block: {}
2018-05-21 16:19:26 +02:00
'block: {
do_thing();
if condition_not_met() {
break 'block;
}
do_next_thing();
if condition_not_met() {
break 'block;
}
do_last_thing();
}
2018-05-21 06:18:06 +02:00
let result = 'block: {
if foo() {
// comment
2018-05-21 16:19:26 +02:00
break 'block 1;
2018-05-21 06:18:06 +02:00
}
if bar() { /* comment */
break 'block 2;
}
3
};
}