MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Functions with optional parameters


Hello everyone,

How can I create functions with optional parameters?  For example, a 
simple function to add two or three numbers:

addThem[a_,b_,c_]:=If[c is not empty, Sum[a,b,c],Sum[a,b]]

I'm not sure of the proper syntax to test whether c is null or empty.

	Greg


  • Prev by Date: Re: LogListPlot
  • Next by Date: foreach loop
  • Previous by thread: Re: Re: Counting Runs
  • Next by thread: Re: Functions with optional parameters