[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: ‘continue’ keyword
- From: David Sicilia <dpsicilia@...>
- Date: Thu, 12 May 2022 15:57:02 -0400
Having an implicit label named ::continue:: so that we could say “goto ::continue::” would work, if somehow that is less intrusive than a ‘continue’ keyword, though I don’t see how it would be, since the latter would just be syntax sugar for the former.
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 <firstname.lastname@example.org> 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