lua-users home
lua-l archive

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


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--