Difference between revisions of "GetArrayLength"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with "===Syntax=== ''function GetArrayLength(X: array of variant): integer;'' '''Parameter Info:''' X (Array of Variant): This paramater can be an array of any data type. '...")
 
(No difference)

Latest revision as of 10:43, 15 August 2012

Syntax

function GetArrayLength(X: array of variant): integer;

Parameter Info:
 X (Array of Variant): This paramater can be an array of any data type.

Description:
 This function will return the length of an array. Example if you have an array of 5 integers {0,1,2,3,4}
 this function will return 5.

 (see also ArrayHigh)

Examples

var
MyArray[0..4] of string;
i: integer;
begin
    MyArray[0] := 'noobs';
    MyArray[1] := 'foo';
    MyArray[2] := 'bar';
    MyArray[3] := 'is';
    MyArray[4] := 'for';
    
    for i := 0 to GetArrayLength(MyArray)-1 do begin
       WriteLn(MyArray[i]);
    end;
end;
Output:
 noobs
 foo
 bar
 is
 for