[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Re[2]: why no "continue" statement for loops?
- From: "Nick Trout" <nick@...>
- Date: Mon, 23 Jun 2003 16:04:13 -0700
> Adding 'continue' would be sort-of "beautiful" since it would make the
> language orthogonal (is that the right word - meaning having the full
> of something, instead of just half of it).
Adding continue would be nice. It is pretty useful and the patch looked
very small.
> I'm sceptical about break N as well (for the same reasons).
Just out of interest, what happens in the following example?
function foo()
local foo2 = function()
while true do
break 2
end
end
while true do
foo2()
end
end
Does the "break 2" exit foo()? Or just foo2()?
I don't really like the idea of "break N", but then I haven't really
used a language that uses it. Using "return" and nested functions
somehow seems cleaner, but if it's optional it might be useful
occasionally.
--nick