On Saturday, 20 September 2025 at 16:43:39 UTC+1 Ian Lance Taylor wrote:
My recollection is that we discussed how to handle an unlabeled break statement in a select statement. Should it break out of the select or should it break out of the enclosing loop? We wanted break in a switch to break out of the switch, not the loop, to be less confusing to C programmers. And select and switch look pretty similar on the page. Handling break the same way for both seemed to make the most sense. It would be nice if break and continue could have an optional "argument" to indicate what to break out of. For example, to break out of a loop inside a switch block you could write "break loop". It would be an implicit label on the nearest loop. I feel this might be common enough to be useful but I can't prove that. At the moment I wouldn't bother with labelling at all and I'm more likely to put the loop inside an anonymous function and return from within the switch. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/1e3b9e32-74e9-407f-b159-dee1dbc05467n%40googlegroups.com.
