Defining Prism allows parameters of the same type to be listed together, separated by commas, and followed with a single data type (more params of different data types can follow, after a semi-colon).
By Reference or Value (and by constant and out) The default for parameters is by value. For by reference, add var in front of the parameter. Prism also offers constant parameters where you add const in front of the parameter. A constant parameter is like a local constant or read-only parameter the compiler can optimize. You cannot assign a value to a constant parameter, 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.) Finally, Prism offers an out parameter type which is like a var parameter except it does not have to be initialized prior.
Syntax Example:
function Add(a, b: integer) : integer; begin Result := a + b; end;
procedure ReplaceTime(var pDT: TDateTime; const pNewDT: TDateTime); begin end;
The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.