lua-users home
lua-l archive

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


On Wednesday, June 27, 2001, at 07:50 AM, Tom Wrensch wrote:

Could you elaborate on the "all sorts of reasons" for not allowing
if-then-else as an expression rather than just a statement?


I think the comment was aimed at the more general "make Lua a functional language", not at the specific "make Lua 'if' an expression".

Note that an alternative approach would be to implement a special
expression version of if-then-else such as Java's <cond> ? <exp1> :
<exp2> form.

That construction, is, of course, a C construction. It happens to be in Java as Java is basically C. It also happens to be in C++.