Hey,
i want to count how many entries are in my ATPA, is this possible and how would i go about doing this?
thanks for any help
Writeln(High(ATPA));
High(x); works for ATPAs. It returns an integer for the highest part of the array.
SCAR Code:Var
ATPA: T2DPointArray;
TPA, TPA2: TPointArray;
TP1, TP2, TP3, TP4: TPoint;
I: Integer;
Begin
TPA := [TP1, TP2];
TPA2 := [TP3, TP4];
ATPA := [TPA, TPA2];
I := High(ATPA) + 1;
Writeln(I);
End.
This returns as '2' in the debug box, the + 1 is there because it starts at 0.
E:'d. Silly detailed responses
![]()
NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN
The actual amount is WriteLn(Length(ATPA))
High is just the largest index.
Isn't that the same thing?
No they can be quite different.
SCAR Code:var
S: array [5..10] of string;
I: Integer;
begin
S[5] := 'see';
S[6] := 'what';
S[7] := 'I';
S[8] := 'mean';
S[9] := '=P';
S[10] := '?';
WriteLn(IntToStr(Length(S)) + ' values');
WriteLn(IntToStr(High(S)) + ' high');
WriteLn(IntToStr(Low(S)) + ' low');
for I := Low(S) to High(S) do
begin
WriteLn('Index: ' + IntToStr(I));
WriteLn('Value ' + S[I]);
end;
end.
Code:Successfully compiled (80 ms) 6 values 10 high 5 low Index: 5 Value see Index: 6 Value what Index: 7 Value I Index: 8 Value mean Index: 9 Value =P Index: 10 Value ? Successfully executed
Well in most cases it'd start at 0.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)