lua-users home
lua-l archive

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


Nevin Flanagan wrote:

While I understand that the phrasing can be noticeably prettier and easier to maintain in some circumstances, is there something "if condition then continue end" does that "if not condition then rest_of_loop end" can't?

Like `break', `continue' can reside inside (deeply) nested if-then constructs, in multiple places. (Your question kind of assumes that `continue' can be only called from the outermost loop level).

while loop() do
  if c1() then
    ......
    if c2() then
       ......
    else
      continue
    end
  end
end

--
Shmuel