[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Compress a sequence of ends
- From: Dirk Laurie <dpl@...>
- Date: Thu, 21 Jul 2011 10:04:29 +0200
On Thu, Jul 21, 2011 at 12:23:55AM +0200, Steve Litt wrote:
> On Wednesday, July 20, 2011 02:02:06 PM Johnson Lin wrote:
> > Actually this discussion comes from:
> > http://redmine.ruby-lang.org/issues/5054
> > annnnnnnnnd I think it's fun to talk about :p What do Lua
> > programmers say?
> Eeeeuuuu, get it offa me!
> Multiple ends facilitate matching, facilitate a quick smell-check of
> indentation, and facilitate syntax handling in Vim and other editors.
> I would never use this syntax, and if approached to maintain code
> using this type of syntax, I would decline.
The one good thing about Basic: you write `NEXT I` at the end of
a loop with control variable `I`. In Lua, if the loop is at all
long, I write as a habit
for k,v in pairs(t)
-- (half a page of code)
end -- k,v
On the other hand, if a loop and a conditional, or nested loops,
have the same body, I write as a habit
for i=1,n if x[i]~=0
Would this last usage be improved by `end2`? Basically, I agree
with Steve: no.