|
On 01/27/2011 11:42 AM, Roberto Ierusalimschy wrote:Do you really need the extra : after the label since both do and break are keywords?
while cond do
do :process_item:
break :process_item:
end
end
Maybe the label is attached to the end keyword since (visually) it indicates where you are going.
There are several details that could change (other mark instead
of colons, whether the label after break needs marks, whether an
optional [or mandatory] label could be added after the corresponding
'end', etc.), but the basic idea would not change much.
while cond do
do
break : process_item
end : process_item
end
That would allow you to label a break out of a while loop:
while cond do
break : while_end
end : while_end
or a for loop:
for i=1, 10 do
break : for_end
end : for_end