LuaJIT supports "goto"
yet doesn't allow break as non-last statement in
a block.
If you use goto, you might as well use goto to exit the
loop. Jumping
after a break using a forward goto seems incredibly dirty to
me...
On 26.07.22 15:27, Paul Ducklin wrote:
>
> >Why should "break" statements be allowed before the
end of a block?
>
> Forward goto?
>
> I don’t think I have ever used goto in Lua but it’s
there for those
> who want it (but was not in 5.1). Maybe that’s the
reason for the
> grammar change?
>
Here is my hypothesis until (or if) an official response
is given. Break is semantically equivalent to "goto break",
and it'd be silly to legislate the usage of labels like
this. The parser only sees break statements as labels.