[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.2 and continue
- From: Mark Hamburg <mark@...>
- Date: Mon, 1 Feb 2010 22:30:27 -0800
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
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.
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.