[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: Mark Hamburg <mark@...>
- Date: Sun, 23 Jan 2011 11:31:05 -0800
Another option would be a continue statement that only works with the addition of a new loop/end statement as well. I would reference Oberon here, but that only sort of works because Oberon doesn't offer continue support in its loop statement.
loop
...
if cond then break end
...
if cond then continue end
...
end
For clarity, I actually prefer break if and continue if constructs here that can potentially be outdented to the loop level, but then one is really designing a new language and they don't work well if you need to be more deeply nested on the conditions (though that may be symptomatic of other code obscurity issues).
A variant on this would be to introduce a next statement that works only with for loops:
for k, v in pairs( t ) do
if not_suitable( k ) then next end
end
That might work well with labels as well.
But I think the disallow the cases with declaration problems is a simpler and less disruptive change if one really must have a continue statement.
Mark
- References:
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, HyperHacker
- Re: I'd give my right arm for a continue statement, Michal Kottman
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, Axel Kittenberger
- Re: I'd give my right arm for a continue statement, David Kastrup
- Re: I'd give my right arm for a continue statement, GrayFace
- Re: I'd give my right arm for a continue statement, T T
- Re: I'd give my right arm for a continue statement, David Kastrup
- Re: I'd give my right arm for a continue statement, Mark Hamburg
- Re: I'd give my right arm for a continue statement, Dirk Laurie
- Re: I'd give my right arm for a continue statement, Shmuel Zeigerman