3 ms·
Rust has special syntax to name loops, and to refer to them by name when breaking. 'foo: loop { 'bar: loop { break 'foo } }
by tomjakubowski 6y ago
Rust has special syntax to name loops, and to refer to them by name when breaking.
'foo: loop {
'bar: loop {
break 'foo
}
}
- berkut 6y agoCool - in which case, at least based on my experience, that would negate the need for goto in the main situation I end up using them in C/C++. The only other time I've seen it be used fairly regularly is cleanup / return handling, where there are other ways of doing that (RAII structures, if you don't mind creating them), but sometimes using goto for that is just simpler / more obvious than having extra structs/classes to handle that.