SRL Archive - Delphi/FPC Help and Tutorials

Is there a typo here?


Lima Bean

2011-11-06 08:48:13

Just a generic funct :)


function name( arr: array of string):array;
var
I : integer;
begin;
for i := 0 to Len - 1 do
result[i] := arr[i];
end;

nielsie95

2011-11-06 09:17:54

You always have to specify a type. "Array" itself wont do. Of course, this type could be a generic type. Generic types still have to be specialized before use, though.

Lima Bean

2011-11-06 09:20:53

I guess my question was too broad, let me narrow some. Will the "I" still output to "result". I know the scope is local to the procedure :):)

nielsie95

2011-11-06 09:29:03

I don't think I really understand your question :p

Lima Bean

2011-11-06 09:36:06

Btw, this is not a trick question :). The code is from mufasatypesutil.pas file

function ConvArr(Arr: array of String): TStringArray; overload;
var
Len : Integer;
I : integer;
begin;
Len := Length(Arr);
SetLength(Result, Len);
for i := 0 to Len - 1 do
result[i] := arr[i];
end;

Gu3st...

2011-11-06 09:38:57

What is the question?

Lima Bean

2011-11-06 09:41:12

Will the I result to result=arr? Am thinking about inconsistent variables…. Beans are primitive that way :)

Method

2011-11-06 09:43:26

The language is case insensitive, so I is the same as i.

Lima Bean

2011-11-06 09:46:02

Ty, just had to check to make sure.