Alistair I do it all the time for standalone procedures. For methods, I
put them in the component/object declaration as private variables -
allowing each invocation to have its own variable.
To: Multiple recipients of list delphi
<[EMAIL PROTECTED]>
Send reply to: [EMAIL PROTECTED]
Date sent: Fri, 13 Jun 2003 15:49:54 +1200
From: Alistair George <[EMAIL PROTECTED]>
Organization: Alistair George Manufacturing
Subject: [DUG]: Non-global Constants in a function
> In the past I have used const in a proc or func to allow re-entering the routine
> later to use the same variable value. But reading the following help it seems I
> am doing the wrong thing. Should I be using a global variable instead?
>
> QUOTE
> A constant (const) parameter is like a local constant or read-only variable.
> Constant parameters are similar to value parameters, except that you can t
> assign a value to a constant parameter within the body of a procedure or
> function, nor can you pass one as a var parameter to another routine. (But when
> you pass an object reference as a constant parameter, you can still modify the
> object s properties.)
>
> eg
> function Tmainform.ParseAddFiles(FName: string; Recurse: boolean): string;
> const PrevDIR: string = '
> ';
> begin
> result := '';
> if pos('*.*', fname) > 0 then
> begin
> PrevDIR := extractfiledir(fname); //This remains until redefined??
> result := Fname;
> exit;
> end;
> if extractfiledir(fname) = prevdir then //this file is already in *.* so omit
> begin
> result := '';
> exit;
> end;
> end;
>
> ---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
Regards
Rohit
====================================================
==================
CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New
Zealand
PH (649) 489-2280
FX (649) 489-2290
email [EMAIL PROTECTED] or [EMAIL PROTECTED]
====================================================
==================
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/