MathGroup Archive 2004

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

Search the Archive

Functions with optional parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51886] Functions with optional parameters
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Thu, 4 Nov 2004 01:49:57 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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