lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

On Thu, May 12, 2022 at 2:37 PM Federico Ferri <federico.ferri.it@gmail.com> wrote:
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 <ubq323@ubq323.website> 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