lua-users home
lua-l archive

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


> Every time I write a little program I end up wanting a continue 
> statement for loops. Does this exist already or is there an 
> alternative 
> that I've missed? If not then how to people not write ugly
> "if this then ... if that then ... if other then ... end end 
> end" code to serve the same purpose of just jumping back to 
> the top of the loop?


There's no switch statement either. You might emulate continue using
break?

	done = false
	while not done do
		local i = 1
		while true do
			if ... then
				break -- continue
			end
			...some processing...
			if ..some test... then
				done = true
			end
			break
		end
		i = i+1 -- next iteration
	end
	

--nick