type
integerArray = array[1..30] of integer;
.....
integerTable = array[1..25,1..25] of integer;
stringArray = array[1..100] of string[15];
This is an example of declaring an array in the type block. The array called 'integerArray' is like a list of integers, if seen on paper it might look like this...
1.______20
2.______145
3.______39
4.______2708
5.______25
6.______260
-
-
-
30._____300
The array called integerTable can be represented by a table. It is a two dimensional array. You can have three,four or even five dimensions in an array if you want.
arrayname[entrynumber]OK HERE COMES AN EXAMPLE PROGRAM
uses Crt;
type
var
begin
while not keypressed do;
Program classTest;
Arrays can also be declared in the variables section without making a type. However it is better to use a type if you plan to use the same type of array in multiple places. So this code in the last program...
{An example program demostration arrays}
{Takes scores from a class test and tells people if they passed or not}testScores = array[1..10] of integer;
i : integer;
marks : testScores;
passOrFail : string[6];
clrscr;
end.
for i := 1 to 10 do
begin
   write ('Please enter test score number ',i,': ');
   readln(marks[i]);
end;
for i := 1 to 10 do
begin
    if (marks[i] < 50) then
     passOrFail := 'Failed';
    else
     passOrFail := 'Passed';
    writeln ('Student no.',i,' ',passOrFail);
end;
var
Can also be written like this:
type
testScores = array[1..10] of integer;
marks : testScores;
var
This would do exactly the same thing, but does not declare a type of 'testScores'.
marks : array[1..10] of integer;