[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: proposal: state machine syntax also usable for continue / nested break
- From: Leo Razoumov <slonik.az@...>
- Date: Fri, 28 Jan 2011 08:25:58 -0500
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--