lua-users home
lua-l archive

Re: I'd give my right arm for a continue statement

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


On 25/01/2011 15:22, Renato Maia wrote:
On 23 Jan 2011, at 17:18, Shmuel Zeigerman wrote:
while condition do
 -- some code
 if test1 then
 -- more code
 if test2 then
 continue
 end
 -- more code
 end
 -- more code
end
Lucky you this code is inside a loop. ;-)
First: this kind of code is pretty common, nothing special. You're doing a few checks, and after the N-th check you see a necessity to move to the next loop iteration. Second: yes, `continue' is always used inside loops. And it is very handy there.
--
Shmuel

AltStyle によって変換されたページ (->オリジナル) /