Mega Code Archive

 
Categories / Delphi / Examples
 

Constants

sometimes the following might cause a problem due to the compiler not being sure if a Char or a String is being referred to: const SNum = '1'; so, to avoid possible run-time errors with constants where you need to be sure that they are of a certain type (eg if later doing a StrComp or similar) then 'typecast' the constant, like this: const SNum = String('1'); OR, say: const INCHES_PER_MILLIMETER: Real = 0.04;