[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: EdK <lists@...>
- Date: Thu, 27 Jan 2011 16:10:59 -0600
Then, a continue could be written like here:
while cond do
do :process_item:
break :process_item:
end
end
I would far rather have a real, explicitly named continue that applied
to the "do" of the loop itself.
while cond do :process:
-- some processing
if somecondition then
break :process: -- stop all processing - break out of the loop the label mentions
elseif someothercondition then
continue :process: -- resume control of loop where "cond" is checked
end
-- other processing
end
In other words, if the label is a requirement of having an actual continue functionality, then I'd put up with that.
But of course, for the above case of continue, the "label" being literally the place where execution would first take place
after a continue would not be correct.
I don't see offhand why an unlabeled loop can't also "continue" if a labeled one could.
I assume this runs into the basic objection to "continue" that has always existed (i.e. where execution next takes place).
Ed Koffeman