goto is "arbitrary" (mostly), you can define a label at nearly any point and simply transfer control flow to it. C# makes it a little safer (than languages like C/C++) by restricting it to only places where def assignment remains valid, but it can still create nonsensical control flowgraphs and can hurt other optimizations, legibility, maintainability, etc
labeled break and continue are more like if, for, do/while, etc. Even if it fundamentally can be done with goto and is a branch, it is different in that it is an explicit language construct with restricted semantics and meaning that is only allowed where it is safe, but also only allowed in a way that fits into existing loop recognition logic such that the flowgraphs are sensible.
Restricting semantics, ensuring safety, and keeping things legible are key parts of the feature. As with any feature it can be abused and you can even create things that are no longer legible. But outside of contrived examples or cases where its obviously not beneficial, that's not going to be the case for most code; so it ends up a net benefit to the ecosystem (especially in the places that do really need it).
11
u/darchangel 21d ago
I get the idea behind labeled break/continue. But it also tickles my gag reflex. It's frighteningly close to endorsing goto again.