Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Functions with optional parameters

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

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.


  • 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