DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Safe Array Looping

An Object Pascal array is a group elements of a similar type with an index range.
How do you access every array element without looking back in your code for the correct lower and upper index values?
The Low and High functions ensure you access each element, as illustrated in this example code:

var
   MyArray : array[2..11] of integer;
   Position : integer;
 
 begin
   for Position := Low(MyArray) to High(MyArray) do
     MyArray[Position] := 0;
 end;

Generated 12:01:28 on Jul 17, 2018