lua-users home
lua-l archive

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


On Fri, 16 Jun 2000, Luiz Henrique de Figueiredo wrote:

> In 4.0 alpha we introduced "break" and labels for "break".
> We are now inclined towards removing these labels (but keeping "break".)
> Would anyone have a *good* use for labels?
> --lhf

Perhaps it's just the patterns that I use when programming, but it's very
rare that I need a multilevel break in any other language that I use.  I
can't imagine that I'll ever want it in Lua.  

You can still break out of multiple loops--it just looks ugly:

local broken = false
while true do
  while true do
    if Test() then
      broken = true
      break
    end
  end

  if broken then
    break
  end
end

By the way, I'm VERY glad that breaks have made it into Lua!  Thanks!

-Fred