lua-users home
lua-l archive

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


It's worth remembering that you can program with continue, but it costs you the ability to break out of the loop:

	real loop do
		repeat -- make continue work
		
			if some_condition() then
				break -- continue
			end

		until true
	end

However, whenever I write this sort of code -- and it mostly seems to come up in server process loops trying to decide what if anything to do next -- I always feel I need to comment it well and I occasionally screw up and write "until false" which doesn't work nearly as well.

Mark

P.S. If I were adding continue to the language, I would probably just disallow it if the innermost loop were a repeat loop rather than trying to come up with a more complicated condition. But that's not an argument for adding it though the code above might be such an argument.