lua-users home
lua-l archive

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


On 28/01/2011 12:19, Roberto Ierusalimschy wrote:
I think the semantics is quite clear: "break :label:" exits the
block with that label, continuing normal execution exactly after its
corresponding "end".

Ah, explained like that, it is indeed clear. Somehow, I was looking hard for a continue, while you were providing a goto, ie. a more versatile tool.
Sorry for the confusion.

Some people regretted it needed an extra level of indentation, but somehow it can be condensed to something like:

  while cond do do :process_item:

    -- code, code, code
    -- some conditional
                    break :process_item:
    -- code, code...

  end end

Although the stutter might seem a little strange... :-)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --