To have an optional param in a UDF, don't declare it. For example, this
UDF has one required and one optional arg:

function greet(firstName) {

var lastName = "";

        //did the user pass 2 or more args?
        if(arrayLen(arguments) gt 1) {
                lastName = arguments[2];
        }

        writeOutput(firstName);
        if(lastName neq "") writeOutput(" " & lastName);

        return true;
}


=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email    : [EMAIL PROTECTED]
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Jared Stark [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, March 04, 2002 2:40 PM
> To: CF-Talk
> Subject: Optional parameters in UDF's
> 
> 
> Is it possible to have optional parameters in a UDF, and if so, how 
> would I do that?
> 
> TIA,
> Jared
> 
> 
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to