SmartPascal
High
Function
Returns the highest value of a type or variable System unit
 function High ( type or variable ) : Ordinal type;
Description
The High function returns the highest 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 higest index.
Notes
For multi-dimensional arrays, it returns the highest index of the first subarray (the left most definition of array range).

The size of an open array is given independent of the starting index of the array. It is the length of the array - 1.
Related commands
Low Returns the lowest value of a type or variable
 
Example code : High 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 high values of the types and variables
  ShowMessage('High(TChar)   = '+IntToStr(Ord(High(TChar))));
  ShowMessage('High(myChar)  = '+IntToStr(Ord(High(myChar))));
  ShowMessage('High(TArray)  = '+IntToStr(High(TArray)));
  ShowMessage('High(myArray) = '+IntToStr(High(myArray)));
  ShowMessage('High(TEnum)   = '+IntToStr(Ord(High(TEnum))));
  ShowMessage('High(myEnum)  = '+IntToStr(Ord(High(myEnum))));
  ShowMessage('High(TShort)  = '+IntToStr(Ord(High(TShort))));
  ShowMessage('High(myShort) = '+IntToStr(Ord(High(myShort))));
end;
Show full unit code
   High(TChar)   = 255
   High(myChar)  = 255
   High(TArray)  = 7
   High(myArray) = 7
   High(TEnum)   = 11
   High(myEnum)  = 11
   High(TShort)  = 255
   High(myShort) = 255