lua-users home
lua-l archive

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


>> Of course, its an extremly personal thing. I just happen to think if -
>> then - end has a great redundancy. if {} is much more conchise.

> This is a silly argument. But I'm in a silly mood...

> Semantically, it's exactly the same thing (or put another way, the
> abstract syntax is the same).

> Otherwise, there are two things to count: characters and tokens. if () {}
> wins on characters (6-9, not counting spaces). if then end wins on tokens
> (3-5). Of course, if () wins in the case that you only need a block, not
a
> statement, in both ways. But it sacrifices consistency to achieve this.

Not to mention the dangling else semi-ambiguity, which is my personal
dislike
for the C syntax. I have always found it disconcerting that you have to put
a ;
in:
   if (a > 0) y = a;
   else y = 1 - a;

To me, the Pascal-like Lua syntax is clearer -- but it's just
a personal prejudice, to be sure.

On a semi-related topic, how do you all indent Lua "if" statements?
Do you put the "then" on the same line as the "if" or on a line by itself?

Rici