Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    5

    Functions and default parameter values

    Is there a way to assign a default value to a parameter in a function definition so that you do not have to enter a value for said parameter when actually calling the function?

    Thanks

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    My understanding is that the variable name being passed is a "local" variable. That said, you should be able to do this:

    Code:
    function MyFunction(sFolder)
         if sFolder == nil then
              sFolder = "C:\\Program Files\\"
         end
         --whatever you need to do here
    end

  3. #3
    Join Date
    Oct 2005
    Posts
    5
    Worm,

    Thanks for the reply. That seems to work. It's a little different than I'm used to, but it does the job. Thanks

    Dave

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    NP, glad I could help.

Similar Threads

  1. 5.0 -- good enhancements, but lacking others
    By dallasfreak2 in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 11-02-2004, 02:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts