[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 13:18:56 -0400
Hi,
> function f(a, b, c)
> a = a or (a == nil and my_default_a)
> b = b or (b == nil and my_default_b)
> c = c or (c == nil and my_default_c)
function f(a, b, c)
a = a == nil and my_default_a or a
b = b == nil and my_default_b or b
c = c == nil and my_default_c or c
end
I think that looks more readable, although it doesn't place emphasis on
keeping the variable passed.
-Mitchell