lua-users home
lua-l archive

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


On Sep 17, 2010, at 8:28 PM, David Manura wrote:

> On Fri, Sep 17, 2010 at 11:11 PM, David Manura <dm.lua@math2.org> wrote:
>>  a = (x then y else z)
> 
> Also compare:
> 
>  return if if x then y else z then if u then v else w else a
>  return ((x then y else z) then (u then v else w) else a)

I will say, I'm actually intrigued by this approach, but from a readability standpoint I prefer having both the parentheses -- to signal that it's an expression -- and the "if" to notify one what sort of expression.

On the other hand, with or without the "if", the following seems pretty unreadable:

	return (if (if x then y else z) then (if u then v else w) else a)

But "properly" formatted it might not be too bad:

	return (if (if x then y else z)
		then (if u then v else w)
		else a)

Still not really pretty, however, but that may just be because it tries to do too much conditional branching without naming the conditions driving the branches. The code moves from "tight" to "tense".

Mark