[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Default value in function parameters?
- From: "Taj Khattra" <taj.khattra@...>
- Date: Tue, 19 Sep 2006 17:55:16 -0700
On 9/19/06, mitchell <firstname.lastname@example.org> wrote:
> a = a or (a == nil and my_default_a)
a = a == nil and my_default_a or a
I think that looks more readable, although it doesn't place emphasis on
keeping the variable passed.
they're not equivalent though since (nil or false) ~= (false or nil).
consider a=nil and my_default_a=false.