These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Array in three 'dimensions'

bikeryamaha
Registered: May 9 2007
Posts: 28

I would like to make up a 'dimensioned' array holding: shipname, shiptype and year as shown in the example below in such a way that the first line would be 'arrayname0' with one dimension: Bismarck, the second dimension: Battleship, and the last dimension: 1941

arrayname=[
"Bismarck", "Battleship", 1941,
"Prince of Wales", Battleship",1941,
]

Could any of you please show me the syntax for writing this code, and the syntax to withdraw eg. the data "1941" from the first entry.

I would be so grateful :)

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
The proper syntax to create an array is:

var ArrayName = new Array([size|elements]);

Values can be added at defintion or added dynamically

// insert values at start
arrayname = new Array(
["Bismarck", "Battleship", 1941],
["Prince of Wales", "Battleship",1941]
);

// dynamic insert of values
arrayname[2] = (["PT 109", "Patrol", 1941]);

console.println("array elements:");
for (i = 0; i < arrayname.length; i++)
console.println("[" + i + "][0]: " + arrayname[i][0] + " [" + i + "][1]: " + arrayname[i][1] + " [" + i + "][2]: " + arrayname[i][2]);

George Kaiser

bikeryamaha
Registered: May 9 2007
Posts: 28
Thank you so much, indeed.
The answer you have given is right what could have hoped for. Perfect!
I'm up running again - thanks!