lua-users home
lua-l archive

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

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.

		if cond then break end
		if cond then continue 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

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.