lua-users home
lua-l archive

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


On Thu, Sep 16, 2010 at 9:40 AM, Jeff Pohlmeyer
<yetanothergeek@gmail.com> wrote:
> pseudo?
>
> function choose(expr,yes,no)
>  if expr then return yes else return no end
> end

That's a function I've written a number of times, but it does evaluate
both yes and no, whether needed or not - a fine idiom for picking one
of two strings or numbers, etc.

I call it 'pseudo' because it would be part of the grammar - only way
one could get that late evaluation.  At least there would be no
arguments about precedence...

steve d.