Results 1 to 9 of 9

Thread: Is there a typo here?

  1. #1
    Join Date
    Sep 2011
    Location
    Earth
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Is there a typo here?

    Just a generic funct


    Simba Code:
    function name( arr: array of string):array;
    var
      I : integer;
    begin;
        for i := 0 to Len - 1 do
        result[i] := arr[i];
    end;
    Last edited by Lima Bean; 11-06-2011 at 02:15 PM.

  2. #2
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    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.
    Hup Holland Hup!

  3. #3
    Join Date
    Sep 2011
    Location
    Earth
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I don't think I really understand your question
    Hup Holland Hup!

  5. #5
    Join Date
    Sep 2011
    Location
    Earth
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

    Simba Code:
    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;

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    What is the question?

  7. #7
    Join Date
    Sep 2011
    Location
    Earth
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Will the I result to result[i]=arr[i]? Am thinking about inconsistent variables.... Beans are primitive that way

  8. #8
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

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

  9. #9
    Join Date
    Sep 2011
    Location
    Earth
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ty, just had to check to make sure.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •