3 ms·
And in most C-style languages that don’t have labelled blocks like this, you can use an infinite loop to achieve the same effect; for example, in Rust where lab
by chrismorgan 5y ago
And in most C-style languages that don’t have labelled blocks like this, you can use an infinite loop to achieve the same effect; for example, in Rust where labelled blocks aren’t yet stable:
'label: loop {
break 'label;
}
And if you want to go one further on that, you can break with value because Rust is expression-oriented:
fn main() {
println!("Hello, {}!", 'label: loop {
break 'label "world";
});
}