2018-05-20 23:18:06 -05:00
|
|
|
// format with label break value.
|
|
|
|
fn main() {
|
2018-06-06 22:15:59 -05:00
|
|
|
'empty_block: {}
|
2018-05-20 23:18:06 -05:00
|
|
|
|
2018-06-06 22:15:42 -05:00
|
|
|
'block: {
|
2018-05-21 09:19:26 -05:00
|
|
|
do_thing();
|
|
|
|
if condition_not_met() {
|
|
|
|
break 'block;
|
|
|
|
}
|
|
|
|
do_next_thing();
|
|
|
|
if condition_not_met() {
|
|
|
|
break 'block;
|
|
|
|
}
|
|
|
|
do_last_thing();
|
|
|
|
}
|
|
|
|
|
|
|
|
let result = 'block: {
|
2018-05-20 23:18:06 -05:00
|
|
|
if foo() {
|
|
|
|
// comment
|
|
|
|
break 'block 1;
|
|
|
|
}
|
|
|
|
if bar() {
|
|
|
|
/* comment */
|
|
|
|
break 'block 2;
|
|
|
|
}
|
|
|
|
3
|
|
|
|
};
|
|
|
|
}
|