[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 and continue
- From: David Kastrup <dak@...>
- Date: Thu, 14 Jan 2010 09:55:15 +0100
Ben Kelly <ranavin@gmail.com> writes:
> Linker wrote:
>> You can just put the loop into a function replacing "continue" with
>> "return".
>>
> And add some more code to distinguish return-as-break and
> return-as-continue, and before you know it the loop is looking quite
> ugly and you're eyeing Metalua speculatively.
i = 1
while i<10 and
(function()
if i%2 == 1 then return true end
if i == 8 then return false end
print(i)
return true
end)() do
i = i+1
end
--
David Kastrup