[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: "continue" construct in Lua loops
- From: Philippe Lhoste <PhiLho@...>
- Date: Thu, 21 Dec 2006 14:46:07 +0100
Javier Guerra a écrit :
On Thursday 21 December 2006 8:21 am, Roberto Ierusalimschy wrote:
Is there a more elegant way?
No :( (At least you can be confident that the generated opcode is
as good as for a primitive continue ;)
i guess both metalua's and token filter's wizards will soon present their
but this is not the first time this has been discussed. i beleive there was a
serious semantic problem; but i can't remember it now
i'd really wish there was a 'continue' statement, in fact i've been using deep
if's, for me the 'break out of repeat' construct is an improvement!!
Yes, I frown as it was a kind of Faq, but since Leo came with a good
solution, that is even marked as "efficient" by Roberto himself, no problem!
I will add this to my toolbox... ;-)
for i = 0, 9 do repeat
if math.mod(i, 2) == 0 then break end
until true end
It has a look of "special loop with continue" syntax... :-)
-- (near) Paris -- France
-- -- -- -- -- -- -- -- -- -- -- -- -- --