 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Maaz Rizki Guest
|
Posted: Wed Jan 24, 2007 8:58 pm Post subject: Function returning record type data or array |
|
|
Hi,
I have been using Delphi 7 for a while, I am able figure out quite few
things. But once in a while I hit wall. I want to send data to a function,
two values in array or record type, and do some processing inside the
function using two values, and return array or record type values back.
Since I need two distinct values out back from function I need that function
return record type of array.
I would highly appreciate a help.
Maaz Rizki
mrizki (AT) fairwaymarket (DOT) com |
|
| Back to top |
|
 |
Craig Stuntz [TeamB] Guest
|
Posted: Wed Jan 24, 2007 9:50 pm Post subject: Re: Function returning record type data or array |
|
|
Maaz Rizki wrote:
| Quote: | Since I need two distinct values out back from function I need that
function return record type of array.
|
You could do that, but easier would be to use out arguments:
procedure DoSomethingToArray(
const AInput: array of integer;
out AOutput1: array of integer;
out AOutput2: array of integer);
var
iItem: integer;
begin
for iItem := Low(AInput) to High(AInput) do begin
AOutput1 := Pred(AInput[iItem]);
AOutput1 := Succ(AInput[iItem]);
end;
end;
procedure Foo;
var
AI, AO1, AO2: array[0..9] of integer;
iItem: integer;
begin
for iItem := Low(AI) to High(AI) do begin
AI[item] := iItem;
end;
DoSomethingToArray(AI, AO1, AO2);
// now use AO1 and AO2...
end;
--
Craig Stuntz [TeamB] ˇ Vertex Systems Corp. ˇ Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of
Irish music out, and it's good: http://tinyurl.com/7hgfr |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|