[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: Leo Razoumov <slonik.az@...>
- Date: Thu, 27 Jan 2011 16:44:31 -0500
On Thu, Jan 27, 2011 at 11:42, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> In Lua, we cannot have traditional labels, because the syntax "foo:"
> already has a different meaning. Instead, a simple syntax would be to
> add labels only to "do end" blocks, for instance like this:
>
> do :label:
> ...
> end
>
> Then, a continue could be written like here:
>
> while cond do
> do :process_item:
>
> break :process_item:
>
> end
> end
>
Roberto,
this is great! Not only it would allow "continue" but this mechanism
will also provide means to break from multiple nested loops in one go.
--Leo--