"continue" construct in Lua loops
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: "continue" construct in Lua loops
- From: "Leo Razoumov" <slonik.az@...>
- Date: 2006年12月21日 08:07:57 -0500
Hi All,
Languages like C and C++ have a handy "continue" construct that skips
to a next loop (for, while) iteration. I am looking for an elegant way
to achieve the same behavior in Lua. So far my best shot is using
"break" inside of "repeat ... until true" block, see below
for i=0,9 do
repeat
if i>=3 and i<=7 then break end --exclude i= 3,4,5,6,7
print(i)
until true
end
Is there a more elegant way?
--Leo--