That's a use for it, but I think it would be cleaner to use a local 
variable to exit the for loop

On Saturday, September 20, 2025 at 4:26:27 AM UTC-6 Jan Mercl wrote:

> On Sat, Sep 20, 2025 at 12:05 PM 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?
>
> For example:
>
> loop:
>         for ... {
>                 switch ... {
>                 case foo:
>                         ...
>                 case bar:
>                         break loop
>                 }
>         }
>
>
>

-- 
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/88a55a5e-00c6-4705-bc7b-e59981839c56n%40googlegroups.com.

Reply via email to