Results 1 to 6 of 6

Thread: Multidimensional Arrays

  1. #1
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Multidimensional Arrays

    EDIT: New problem, see latest post.

    EDIT: Nevermind solved

    EDIT: Just because Nauman said so :

    This is how you declare a multidimensional array:

    myarray: Array [1..9] of Array [1..9] of Integer;

  2. #2
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    You need to set the length of it. Either change "tehsecret: Array of Array of Integer;" to "tehsecret: Array [1..9] of Array [1..9] of Integer;", or set the length of tehsecret to 10, and loop through tehsecret[1] through [9] and set their lengths to 10.

  3. #3
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah, figured it was something like that lol. Thanks. Rep+

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Runescapian View Post
    Ah, figured it was something like that lol. Thanks. Rep+
    You might want to keep the first post, as it may help other people who encounter the same error

  5. #5
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    You need to set the length of it. Either change "tehsecret: Array of Array of Integer;" to "tehsecret: Array [1..9] of Array [1..9] of Integer;", or set the length of tehsecret to 10, and loop through tehsecret[1] through [9] and set their lengths to 10.
    Afaik if he does it like that he will have to do

    SCAR Code:
    Bob[0][0] := 1;
    Bob[0][1] := 2;

    I guess if this information is being added at runtime and is not static I guess it does not make a difference. But if that information is never going to change ... well 10 arrays of a array of 10 is 100 integers, and that means writing out bob[x][x] a hundred times. If he does not set the length and just does

    SCAR Code:
    Bob[0] := [0, 1, 2, 3, 4];

    It becomes much easier.

  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Or Bob := [Tintegerarray([0, 1, 2, 3, 4])];.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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