Like this: Test( 1,2,3,4,Null,Null );

On Aug 18, 2010, at 10:51 AM, rise_t575 wrote:

> Unfortunately doesn't work; the function call obviously wants its full set of 
> arguments/parameters:
> 
> function Test (Var1,Var2,Var3,Var4,Var5)
> {
> if(IsNull(Var5))
> {
> Var5 = 0;
> }
> xyz = Var1+Var2+Var3;
> return xyz;
> }
> 
> Test(1,2,3,4);
> 
> --- In [email protected], Dennis Brown <se...@...> wrote:
>> 
>> I believe that you must supply all arguments on a function you define.  Only 
>> built-in functions can have optional parameters AFAIK.
>> If your intention is to be able to have a default substituted in a function 
>> for missing arguments, then I would pass a null for each parameter to be 
>> defaulted.  That way, at the beginning of your function, you could write 
>> something like:
>> if( isNull( optionalD ) ) { optionalD = defaultValueD; }
>> 
>> BR,
>> Dennis
>> 
>> On Aug 17, 2010, at 4:41 PM, rise_t575 wrote:
>> 
>>> 
>>> 
>>> Thanks. Just created a new, very simple AFL script for testing and it 
>>> creates a "Missing Arguments" error.
>>> 
>>> --- In [email protected], "Edward Pottasch" <empottasch@> wrote:
>>>> 
>>>> yes. You probably made a syntax error. There are examples in the manual,
>>>> 
>>>> regards, Ed
>>>> 
>>>> 
>>>> 
>>>> 
>>>> From: rise_t575 
>>>> Sent: Tuesday, August 17, 2010 8:38 PM
>>>> To: [email protected] 
>>>> Subject: [amibroker] function() - optional parameters?
>>>> 
>>>> 
>>>> 
>>>> Just wondering if it is possible to use optional parameters in the 
>>>> function() function (no pun intended...), e. g.
>>>> 
>>>> function Test ( a, b, c, optionalD, optionalE );
>>>> 
>>>> Would the function call
>>>> 
>>>> Test( 1, 2, 3 );
>>>> 
>>>> generally work in this case?
>>>> 
>>>> I've tried it, but something doesn't seem to work correctly - so I want to 
>>>> make sure that this is generally possible.
>>>> 
>>>> Thanks in advance!
>>>> 
>>> 
>>> 
>>> 
>>> 
>>> ------------------------------------
>>> 
>>> **** IMPORTANT PLEASE READ ****
>>> This group is for the discussion between users only.
>>> This is *NOT* technical support channel.
>>> 
>>> TO GET TECHNICAL SUPPORT send an e-mail directly to 
>>> SUPPORT {at} amibroker.com
>>> 
>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>> http://www.amibroker.com/feedback/
>>> (submissions sent via other channels won't be considered)
>>> 
>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>> http://www.amibroker.com/devlog/
>>> 
>>> Yahoo! Groups Links
>>> 
>>> 
>>> 
>> 
> 
> 
> 
> 
> ------------------------------------
> 
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
> 
> TO GET TECHNICAL SUPPORT send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> Yahoo! Groups Links
> 
> 
> 

Reply via email to