Link to home
Create AccountLog in
Avatar of Mark_FreeSoftware
Mark_FreeSoftwareFlag for Netherlands

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
SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Mark_FreeSoftware

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?
I'm OK.
Avatar of Mike McCracken
Mike McCracken

Fine by me.

Thanks for-Soft, I couldn't remember.  I thought it was not allowed but wasn't sure.

mlmcc
Glad i could help

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.

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.