lua-users home
lua-l archive

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


Geoff Leyland wrote:
> In most languages I've seen, it's uncommon to put multiple
> stand-alone statements on the same line.

Well, I do it quite a lot; e.g.
   i=1; j=1; k=1;
where the three statements form a semantic unit. Just like in
maths prose you might see: "In the x=1 y=3 case this becomes..."

Or:
   param1 = string.byte(trackdata, i); i = i+1
   param2 = string.byte(trackdata, i); i = i+1
where it's vital that the extraction of the parameter never gets
separated from the increment of the index.

> Why use a semicolon where a newline would do?

It saves space on the screen, thus giving a better overview of
the code while editing.

I must say, though, that I'd suffer mandatory newlines any day
rather than the the kind of de-whitespaced javascript you often
see, with all semicolons and no newlines (shudder...)

Regards,  Peter Billam

http://www.pjb.com.au       pj@pjb.com.au      (03) 6278 9410
"Was der Meister nicht kann,   vermöcht es der Knabe, hätt er
 ihm immer gehorcht?"   Siegfried to Mime, from Act 1 Scene 2