Mark_FreeSoftware
asked on
Procedure optional param
hello experts,
as the title states,
i would like to have a procedure with an optional parameter,
is this possible, and so yes, how?
example:
procedure WriteXY(str:string;X:byte; Y:byte; ?Optional? Color as byte);
so that Color is not giving an error when it isn filled
mark
as the title states,
i would like to have a procedure with an optional parameter,
is this possible, and so yes, how?
example:
procedure WriteXY(str:string;X:byte;
so that Color is not giving an error when it isn filled
mark
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I'm OK.
Fine by me.
Thanks for-Soft, I couldn't remember. I thought it was not allowed but wasn't sure.
mlmcc
Thanks for-Soft, I couldn't remember. I thought it was not allowed but wasn't sure.
mlmcc
Glad i could help
mlmcc
mlmcc
Although this thread is closed, I would like to add a bit of a correction. It is possible to assign a (default) value to a parameter, rendering it optional. You can also do some trickery with function overrides.
Reference:
http://delphi.about.com/od/beginners/l/aa050900a.htm
======================
Thanks to Netminder for allowing me to add this post-PAQ comment.
Reference:
http://delphi.about.com/od/beginners/l/aa050900a.htm
======================
Thanks to Netminder for allowing me to add this post-PAQ comment.
ASKER
cool!
but since that page is for delphi,
does that work in pascal too?
according to the content at the link, this applies to Object Pascal, and started with Delphi 4.
ASKER
too bad.....
then i'm going for a split between you two, because you both added to the final aswer
are you ok with that?