|
On Sep 8, 2013 11:19 AM, "steve donovan" <steve.j.donovan@gmail.com> wrote:
>
> On Sun, Sep 8, 2013 at 4:47 PM, Seppl Vorderhörer
> <Seppl.Vorderhoerer@t-online.de> wrote:
> > 99% of all programmers seen as) "operations that use conditions and result
> > in other conditions" are here really misused to not return booleans but
> > other types.
>
> Using 'or' like this is a popular Lua idiom, often used for default values:
>
> function foo(a,b)
> a = a or 'one'
> b = b or 'two'
> ...
> end
>
> It is a _little_ odd at first, but then very liberating.
Almost the same as perl's // operator, except // does not treat nil (undef) the same as false
>
> steve d.
>
>