[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why is "then" required in the if statement?
- From: Matt Campbell <mattcampbell@...>
- Date: Sat, 01 Dec 2007 15:38:21 -0600
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:
is quite readable, and less cluttered than
if foo then
albeit by just one keyword.
Besides, sometimes I forget the "then" keyword.