Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function High(X);
Returns the upper limit of an Ordinal, Array, or ShortString value.
The result type is X, or the index type of X.
//example 1
type TExperience=(Beginner, Intermediate, Advanced);
var aProg : TExperience;
aProg := High(aProg); //aProg = Advanced
//example 2
var
dblArray: array[1973..2003] of Double;
i : integer;
for i:= Low(dblArray) to High(dblArray) do
begin
// add code for i going from 1973 to 2003
end
//example 3
//->: sum an array (vector) of real values
//(without knowing the array dimensions)
function Sum(var X: array of Double): Double;
var i: Word;
begin
Result := 0;
{Note that open array index range is always zero-based.}
for i := 0 to High(X) do Result := Result + X[i];
end;
|
Arrays in Object Pascal
Understanding and using array data types in Delphi.
Ordinal and Enumerated Data Types
Learn about Delphi's support for ordinal types. Extend Delphi's built-in types by constructing your own types.
Low,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|