Delphi IDE (89)
Windows with Delphi (280)
Visual Basic (1)
About this site
Links to us
Safe Array Looping
This article has not been rated yet. After reading, feel free to leave comments and rate it.
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:
MyArray : array[2..11] of integer;
Position : integer;
for Position := Low(MyArray) to High(MyArray) do
MyArray[Position] := 0;
anonymous from China
this code is very easy