4 ms·
Unless I'm misunderstanding the mechanism (jumping to a label, right?), I thought most (well, lots of) languages supported this. Go does also: A non-minimal e
by ratrocket 4y ago
Unless I'm misunderstanding the mechanism (jumping to a label, right?), I thought most (well, lots of) languages supported this. Go does also:
A non-minimal example using continue (but you can also break): https://go.dev/play/p/mEyEqcEYvcK https://go.dev/play/p/mEyEqcEYvcK
The spec: https://go.dev/ref/spec#Labeled_statements https://go.dev/ref/spec#Labeled_statements
It's just goto..? And despite "considered harmful", lots of languages have goto.
There are some things for which goto (or labeled break/continue) really are the best way to do what you need.
(I can't shake the feeling I'm missing something really obvious here!)