[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tri-condition
- From: Sam Roberts <sroberts@...>
- Date: Wed, 25 Oct 2006 09:52:54 -0700
On Wed, Oct 25, 2006 at 12:47:54PM +0300, askok@dnainternet.net wrote:
> Took a new approach to the ? : dilemma, this solution is
> using Lua scripts only.
I miss the ternary operator, but I just do
function tf(c,t,f) if c then return t else return f end end
I wonder why '?' isn't allowed in a Name in the BNF? Since it isn't used
anywhere else, why is it special?
function ?(c,t,f) if c then return t else return f end end
I would also be happy if more lua statements were expressions:
function doit(switch)
local x = if switch then "this" else "that" end
...
I don't need the ternary as an operator, but I don't like code like:
function doit(switch)
local x = "that"
if switch then x = "this" end
...
I'm a fan of single initialization.
Sam