Description |
The Low function lowest allowed value of either a type or variable of that type.
It only applies to characters, arrays, enumerations and short strings.
For arrays, it returns the lowest array index.
|
|
Notes |
For multi-dimensional arrays, it returns the lowest index of the first subarray (the left most definition of array range).
The lowest element of an open array is given independent of the starting index of the array. It is always 0.
|
|
Related commands |
High |
|
Returns the highest value of a type or variable |
|
|
|
Example code : Low applied to character, array, enumeration and short strings |
type // Declare character, array and enumerated data types
TChar = char;
TArray = array [3..7] of Integer;
TEnum = (Mon=5, Tue, Wed, Thu, Fri, Sat, Sun);
TShort = shortstring;
var // Declare variables of the above data types
myChar : TChar;
myArray : TArray;
myEnum : TEnum;
myShort : TShort;
begin // Show the low values of the types and variables
WriteLn('Low(TChar) = '+IntToStr(Ord(Low(TChar))));
WriteLn('Low(myChar) = '+IntToStr(Ord(Low(myChar))));
WriteLn('Low(TArray) = '+IntToStr(Low(TArray)));
WriteLn('Low(myArray) = '+IntToStr(Low(myArray)));
WriteLn('High(myArray) = '+IntToStr(High(myArray)));
WriteLn('Low(TEnum) = '+IntToStr(Ord(Low(TEnum))));
WriteLn('Low(myEnum) = '+IntToStr(Ord(Low(myEnum))));
WriteLn('High(myEnum) = '+IntToStr(Ord(High(myEnum))));
WriteLn('Low(TShort) = '+IntToStr(Ord(Low(TShort))));
WriteLn('Low(myShort) = '+IntToStr(Ord(Low(myShort))));
end;
|
Show full unit code |
Low(TChar) = 0
Low(myChar) = 0
Low(TArray) = 3
Low(myArray) = 3
Hig( myArray) = 7
Low(TEnum) = 5
Low(myEnum) = 5
Hig( myEnum) = 11
Low(TShort) = 0
Low(myShort) = 0
|
|