Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Create a static 2d array?



Permlink Replies: 2 - Last Post: Nov 9, 2015 4:32 PM Last Post By: Ian Branch
Ian Branch

Posts: 442
Registered: 9/23/99
Create a static 2d array?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2015 3:43 PM
Hi Team,

Working in Delphi 10 Seattle.
I need to fill an array that looks like the following..

ABC &ABC
DEF &DEF
GHI &GHI
JKL &JKL

I am declaring it in the const section.

I thought aMyArray : Array [0 .. 3,0..0] of string = ((ABC','&ABC'), ('DEF','&DEF') , ('GHJI','&GHI') , ('JKL','&JKL')); might do it but it doesn't like it.

Clearly I am doing something wrong.
Appreciate being appropriately edificated.

Regards & TIA,
Ian
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Create a static 2d array?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2015 4:20 PM   in response to: Ian Branch in response to: Ian Branch
Ian wrote:

I need to fill an array that looks like the following..

ABC &ABC
DEF &DEF
GHI &GHI
JKL &JKL

I am declaring it in the const section.

I thought aMyArray : Array [0 .. 3,0..0] of string = ((ABC','&ABC'),
('DEF','&DEF') , ('GHJI','&GHI') , ('JKL','&JKL')); might do it but

it doesn't like it.

You are missing an opening quotation mark on the first string, and the upper
bound of your second dimension is wrong. The correct declaration is:

const
  aMyArray : Array [0..3, 0..1] of string = (('ABC','&ABC'), ('DEF','&DEF'), 
('GHJI','&GHI'), ('JKL','&JKL'));


--
Remy Lebeau (TeamB)
Ian Branch

Posts: 442
Registered: 9/23/99
Re: Create a static 2d array?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 9, 2015 4:32 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:

it doesn't like it.

You are missing an opening quotation mark on the first string, and the upper
bound of your second dimension is wrong. The correct declaration is:
Ahhh. Thanks Remy.
In my actual code the quote isn't missing but I had the dimensioning wrong.

Regards & many thanks for the quick response/resolution.

Ian
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02