lua-users home
lua-l archive

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


On Thu, 2006-01-26 at 15:23 +0000, David Given wrote:
> Incidentally, C-like languages have:
> 
> if (expression) statement else statement
> where { statementlist } is a statement.
> 
> Lua has:
> 
> if expression then statementlist else statementlist end
> where begin statementlist end is a statement.
> 
> The then...else...end in an if is a completely different syntactic concept 
> from begin...end --- Lua's if *inherently* can cope with multiple statements, 
> where C's if can't.

Not to mention avoiding the old 'else' ambiguity:

if (a) if (b) c(); else d();

"Is the else attached to the a or b if?"

- Mab