On Sat, Sep 20, 2025, 3:05 AM Dean Schulze <[email protected]> wrote:

> The break keyword terminates execution of a select statement, but is there
> any real use for break in a select / case statement?
>
> The select statement executes one of its cases that can proceed or the
> optional default statement and then program execution continues after the
> select {...} block.  Since the select statement will complete after a case
> or default completes what reason is there to use break  in a case or
> default?  I can't think of one.
>
> Using break in a select / case statement seems pointless.
>

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.

Ian

>

-- 
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/CAOyqgcXFPN103mM5zYbb7mpAHiHuNJdik31GM%3DcTejos8hCZEw%40mail.gmail.com.

Reply via email to