[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: ‘continue’ keyword
- From: Federico Ferri <federico.ferri.it@...>
- Date: Thu, 12 May 2022 20:36:46 +0200
The difference between 'break' and 'goto' is that you can use 'break' without argument, and it will exit from the *current* loop. But to do the same with 'goto', you need to also define the label for the goto, and this extra repetitive step is what people tend to dislike.
The language could do a favor to the programmer, and define -or imply it exists anyway- a ::break:: label that points to the end of the *current* for loop, then you could say 'break' it is roughly the same as 'goto ::break::' ;)
On Thu, May 12, 2022 at 8:23 PM ubq323 <email@example.com> wrote:
> Also I know that theoretically this can achieved using ‘goto’ but I don’t
> like that approach.
why not? it has the same effect