Hi Al, The quote you mention is talking about constant PARAMETERS. You're talking about having the value of a constant INSIDE a method maintain it's state between invocations.
If you want to take an OO purist POV, don't ever use 'global' variables. ;-) IMHO, don't even use variables in the implementation section of your units, unless you're using them to implement something like the Singleton pattern. Most/all variables outside individual methods should be field variables or properties. Maybe a more OO way to provide a solution would be a separate file parser class, which would handle file parsing, and would be able to remember state between invocations. Without seeing the rest of your code, a simple suggestion would be a private field level variable in your class (TMainForm) to store values between invocations. Although, if I'm correct in thinking you're building a recursive method (as hinted by the Recurse param!), you maybe don't need to maintain state between invocations, but again, I can't help without seeing a bit more code. HTH, Conor -----Original Message----- From: Alistair George [mailto:[EMAIL PROTECTED] 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/