Post Reply 
Can programs have optional arguments?
09-10-2017, 05:35 AM
Post: #7
RE: Can programs have optional arguments?
Bonjour, Hello

Par exemple :
For exemple :

Code:

Export Func(p)
BEGIN
Local a,b,c
a:=p(1);b:=p(2);
IFERR c:=p(3) THEN c:=0; END;
....
....
END;

Func({10,15,2}) -> c=2
Func({10,15}) -> c=0

C'est un peu artisanal mais cela fonctionne.
It's a little crafty but it works.

Si il y a plusieurs arguments optionnels et d'autres obligatoires vous pouvez mixer.
If there are several optional arguments and mandatory others you can mix.

Code:

EXPORT Func(a,b,p)
BEGIN
LOCAL c,d,e
IF TYPE(p)==6 THEN
 c:=p(1);d:=p(2);e:=p(3)
ELSE
 c:=p;d:='def value';e:='def value';
END;
...
...
END;

Espérant vous avoir aidé.
Hoping you helped.

Sorry for my english
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Can programs have optional arguments? - Tyann - 09-10-2017 05:35 AM



User(s) browsing this thread: 6 Guest(s)