[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Default value in function parameters?
- From: mitchell <mforal.news@...>
- Date: Tue, 19 Sep 2006 22:10:36 -0400
Hi,
>> > 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.
Yes, you are correct. My mistake. Very subtle...
-Mitchell;