lua-users home
lua-l archive

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


Obviously I meant 'continue' and ::continue::, as 'break' already exists.

On Thu, May 12, 2022 at 8:36 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