lua-users home
lua-l archive

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

On Fri, Jul 29, 2022 at 7:48 AM Lorenzo Donati <> wrote:
There will be algorithms where adding a nesting level won't mess things
up just because, say, "break 2" does the right thing regardless of the
nesting level, whereas with "goto loop2/ break loop2" you could have to
move the label around.

Debugging will be a lot of fun when "break 2" should really be "break 3" or vice versa. 'break' with a label makes things a bit more obvious. Using a labeled break has the advantage that it's still a structured programming construct, but I'm OK with putting a label after a 'break' and jumping out of a set of nested loops occasionally. I've found that I hardly ever need to do that, especially in Lua 5.4 which simplified cleanup like closing file handles by adding the <close> feature.