lua-users home
lua-l archive

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

On Tue, Sep 20, 2005 at 09:38:39PM -0500, wrote:
> A little late, but ...
> The semantics of continue is available in Lua. No patch required.
> while something do
>   repeat
>     ...
>     if expr then break end
>     ...
>   until true
> end
> Here 'break' is read as 'goto end of block' ('continue', if you
> prefer :-)), and 'repeat ... until true' is read as 'block ... end'.

too sad you are losing the semantics of break -- bad deal.

likewise with
while (function () -- clearly you'd rather create function only once
  print(i) -- but it would be less readable
  if i<3 then return true end -- continue
  -- break
end)() do

now you have break and continue plus a "continue block",
but sacrificy return.