I want a function to return an array [0..3] of integer... How can I do that?
I want a function to return an array [0..3] of integer... How can I do that?
The jealous temper of mankind, ever more disposed to censure than
to praise the work of others, has constantly made the pursuit of new
methods and systems no less perilous than the search after unknown
lands and seas.
uhmm if this is what you want...
SCAR Code:program New;
// Example 1
function GetNumbers : array of integer;
begin
Result := [1, 2, 3];
end;
var
i : array of integer;
begin
i := GetNumbers;
Writeln(inttostr(i[1]));
end.
SCAR Code:program New;
// Example 2
function GetNumbers : array of integer;
begin
SetArrayLength(Result, 3);
Result[0] := 1;
Result[1] := 2;
Result[2] := 3;
end;
var
i : array of integer;
begin
i := GetNumbers;
Writeln(inttostr(i[1]));
end.
i think is what you want?SCAR Code:procedure WalkFromJetty;
var
Woo: array[0..3] of integer;
i: integer;
begin
Woo[0]:=
Woo[1]:=
Woo[2]:=
Woo[3]:=
for i:=0 to 3 do
//whatever
end;
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
no< i meant that i want a function to return an array of integer>
The jealous temper of mankind, ever more disposed to censure than
to praise the work of others, has constantly made the pursuit of new
methods and systems no less perilous than the search after unknown
lands and seas.
whats shift broken mean? and can you tell me what you are trying to do(specifically)
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
A function I have determines a box on the minimap as an array of integers. I want to output that to a clicking procedure.
The jealous temper of mankind, ever more disposed to censure than
to praise the work of others, has constantly made the pursuit of new
methods and systems no less perilous than the search after unknown
lands and seas.
Then use this method (edited SKy's one a bit):
?Code:function GetNumbers: array of Integer; begin Result:= [1, 2, 3]; end; var aoI: array of Integer; i: Integer; begin aoI:= GetNumbers; for i:= 0 to GetArrayLength(aoI) - 1 do WriteLn(IntToStr(aoI[i])); end.
Just do some editing, from WriteLn's to clicking (or whatever you meant with clicking procedure)...
If that doesn't help at all, then try to explain a bit better what you are trying to do and/or maybe post the part of your script to here.![]()
Put in the 4 integers, and it'll return a TBox, a TBox stores 4 valuesCode:function IntToBox(x1, y1, x2, y2: Integer): TBox;
Hopefully that's what you want, and if you know TPoint's there's also.Code:(x1, y1)-------- | | | | | --------- (x2, y2)
Code:function PointToBox(p1, p2: TPoint): TBox;
There are currently 1 users browsing this thread. (0 members and 1 guests)