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 cant
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
objects 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/