[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: Steve Litt <slitt@...>
- Date: Sun, 23 Jan 2011 15:26:07 -0500
On Sunday 23 January 2011 14:04:09 Dirk Laurie wrote:
> On Sun, Jan 23, 2011 at 08:16:10PM +0200, Mark Hamburg wrote:
> > Three seemingly simple answers to the repeat/until v continue problem (in
> > order of decreasing harshness but more complex definitions):
>
> I haven't been following this discussion all that closely, so please
> forgive me if I have missed a point that has been made.
>
> The most common use of continue occurs when it is required once per
> loop. In that case, it actually costs four extra keystrokes.
>
> while condition do
> -- some code
> if test then
> continue
> end
> -- more code
> end
>
> while condition do
> -- some code
> if test then
> else
> -- more code
> end
> end
Speaking personally just for myself, I really hate that extra level of
indentation. For me personally, the more levels of branching I have, the
likelier errors become.
>
> If you require it more than once, you'll save only whitespace.
> It will still need four extra non-blank characters per instance.
>
> You expect, seriously expect, Roberto to add another keyword just
> so you can do THIS???
First, as the originator of this thread, I apologize for the subject line.
What I was asking in the message body was "Have any of you found convenient
ways to simulate a continue statement in Lua?", so the subject should have
been "Workarounds for continue statement?". That message was written while
solving a frustrating problem at 3am, but that's no excuse -- I apologize.
I never expected anyone to change the language. Language changes bring a risk
of both introducing bugs and breaking existing code. And they're a lot of
extra work.
I actually found a workaround that will work for me once it's cleaned up a
little. Sure, it's been called "using a sledgehammer to chase a mouse", but
the fact it scratches my itch -- I no longer have to descend that extra level
just to rule out lines that obviously don't qualify to be processed.
SteveT
Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt