Difference between revisions of "High"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function High(x): Int64; </source> ==Availability== SCAR Divi 3.00 > Current ==Description== Returns the upper bound of an arr...")
 
(No difference)

Latest revision as of 09:57, 29 June 2011

Definition

function High(x): Int64;

Availability

SCAR Divi 3.00 > Current

Description

Returns the upper bound of an array or data type specified in x. The function only works with arrays and Category:Basic Types, the entry format is fairly trivial, it can be a value, constant or variable.

Example

var
  a: array[1..5] of string;
  b: TStringArray;
  c: Integer;
  d: Byte;
begin
  SetLength(b, 5);
  WriteLn('The upper-bound of static array with range 1..5 is ' + IntToStr(High(a)));
  WriteLn('The upper-bound of a dynamic array with length 5 is ' + IntToStr(High(b)));
  WriteLn('The upper-bound of an integer is ' + IntToStr(High(c)));
  WriteLn('The upper-bound of a byte is ' + IntToStr(High(d)));
end.

Output:

The upper-bound of static array with range 1..5 is 5
The upper-bound of a dynamic array with length 5 is 4
The upper-bound of an integer is 2147483647
The upper-bound of a byte is 255

See Also