[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [patch] continue statement
- From: Klaus Ripke <paul-lua@...>
- Date: Wed, 21 Sep 2005 08:52:56 +0200
On Tue, Sep 20, 2005 at 09:38:39PM -0500, email@example.com wrote:
> A little late, but ...
> The semantics of continue is available in Lua. No patch required.
> while something do
> if expr then break end
> until true
> 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.
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
now you have break and continue plus a "continue block",
but sacrificy return.