lua-users home
lua-l archive

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


On Fri, Jan 28, 2011 at 08:07, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> This explains a lot. As you, most people ask for 'continue' because
> they learned to use it from other languages. People do not ask for
> labeled breaks because few languages offer it, and so many people have
> not yet learned to use it.
>

With labeled breaks one can "break out" or "continue" from multiple
nested loops in one go, a feat not possible with C-style
break/continue that operate entirely within the inner-most loop. Of
course, one should not abuse such long jumps in control flow (goto
considered harmful), for it could make code less readable. But when
used with care it makes code more readable and efficient by
eliminating auxiliary flags and corresponding conditional statements
introduced for the sole purpose of breaking out of multiple nested
loops.

--Leo--