[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: labels
From:       Fred Bertsch <fb () ee ! cornell ! edu>
Date:       2000-06-16 20:58:38
Message-ID: Pine.HPX.4.21.0006161641080.16253-100000 () surge ! ee ! cornell ! edu
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic