lua-users home
lua-l archive

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

I'd guess most people would find "if foo then bar end" more readable than "if foo bar end".

If readability of one-liners is that important, then I suggest that "if (foo) bar end" is better than either. Of course, I'm not suggesting that Lua require parentheses around the condition; it's up to the programmer to decide where parentheses would be helpful. Anyway, while a language design can encourage readability, it shouldn't attempt to force readability; that's the programmer's job. Rather, a language design should encourage both readability and succinctness. For multi-line if statements, I think that:

if foo

is quite readable, and less cluttered than

if foo then

albeit by just one keyword.

Besides, sometimes I forget the "then" keyword.